Tuesday, December 7, 2010

Some command line utils for git conflict resolution

Git has some nice utilities that can make dealing with conflicts much easier.

If after merging you just want to keep either the remote (theirs) or your own file (ours), you can checkout the file with either --ours or --theirs options as in:
git checkout --ours index.html
git checkout --theirs template.html

In order to look at the original files, git show :1:filename shows the common ancestor, git show :2:filename shows the HEAD version, and git show :3:filename shows the MERGE_HEAD version.



Sources:
Keep either file in a merge conflict

No comments:

Post a Comment