Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve a conflict after git pull?

I have to solve some conflict after a git pull.

$ git pull CONFLICT (rename/add): Renamed vignette_generator_mashed.h->vision_problem_8.h in 49423dd0d47abe6d839a783b5517bdfd200a202f. vision_problem_8.h added in HEAD Added as vision_problem_8.h~HEAD_1 instead Removed vignette_generator_cross_square.cc Automatic merge failed; fix conflicts and then commit the result. 

So I googled it a bit, and found people saying using git mergetool. But here is what I got:

$ git mergetool merge tool candidates: meld kdiff3 tkdiff xxdiff meld gvimdiff emerge opendiff emerge vimdiff No files need merging $ git mergetool opendiff merge tool candidates: meld kdiff3 tkdiff xxdiff meld gvimdiff emerge opendiff emerge vimdiff opendiff: file not found 

So does it mean I have to install something?

What if I simply want the version from git pull to overwrite everything?

like image 794
Tim Avatar asked Sep 16 '09 22:09

Tim


People also ask

How do you resolve conflicts in git?

Git commands that can help resolve merge conflicts The status command is in frequent use when a working with Git and during a merge it will help identify conflicted files. Passing the --merge argument to the git log command will produce a log with a list of commits that conflict between the merging branches.

How do I resolve conflicts in git pull request Visual Studio?

Visual Studio will notify you if Git halted the merge due to conflicts. In that event, you can either resolve the conflicts, or cancel the merge and return to the pre-merge state. To resolve conflicts, choose Conflicts to open the Resolve Conflicts view.


1 Answers

You don't need mergetool for this. It can be resolved pretty easily manually.

Your conflict is that your local commits added a file, vision_problem_8.h, that a remote commit also created, by a rename from vignette_generator_mashed.h. If you run ls -l vision_problem_8.h* you will probably see multiple versions of this file that git has preserved for you. One of them will be yours, another of them will be the remote version. You can use an editor or whatever tools you like to resolve the conflicting contents. When you're done, git add the affected files and commit to complete the merge.

If you just want to use the remote commit's version, then you can just move the copy that you didn't write into place and git add it.


Regarding the merge tools, have a look at git help mergetool. Basically, it's going to try running each of the included possibilities until it finds one, or use one you have explicitly configured.

like image 160
Phil Miller Avatar answered Sep 20 '22 19:09

Phil Miller