git conflict resolution
Logging this mostly for myself.
When a conflict occurs during a pull operation from remote repository, we get this:
$ git pull kumo1 develop From ssh://kumo0/home/wil/... * branch develop -> FETCH_HEAD Auto-merged src/.../file.py CONFLICT (content): Merge conflict in src/.../file.py Automatic merge failed; fix conflicts and then commit the result.
What git did was to fetch objects from the remote repository, and tried to merge it in the branch that you specified. Sometimes the merge operation fails due to a conflict, and the conflicting edits are left in the file. It is then up to you to eyeball the file, straighten it and then “commit the result” (as the message said.)
However, if you tried to commit that file (after fixing the conflict), you’d get this:
$ git commit -m "my fixes" src/.../file.py fatal: cannot do a partial commit during a merge.
What you’d want is to add the -i argument to the git commit command, which tells it to stage the additional file before committing.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
February 24th, 2011 at 10:56 am
Thanks. I needed that
July 12th, 2011 at 4:39 pm
Thanks, was looking for it.
April 13th, 2012 at 11:01 am
Thanks! Adding the -i option works for me.