Posts

Showing posts with the label Git Merge Conflict

Choose Git Merge Strategy For Specific Files ("ours", "mine", "theirs")

Answer : For each conflicted file you get, you can specify git checkout --ours -- <paths> # or git checkout --theirs -- <paths> From the git checkout docs git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>... --ours --theirs When checking out paths from the index, check out stage #2 ( ours ) or #3 ( theirs ) for unmerged paths. The index may contain unmerged entries because of a previous failed merge. By default, if you try to check out such an entry from the index, the checkout operation will fail and nothing will be checked out. Using -f will ignore these unmerged entries. The contents from a specific side of the merge can be checked out of the index by using --ours or --theirs . With -m , changes made to the working tree file can be discarded to re-create the original conflicted merge result. Even though this question is answered, providing an example as to what "theirs" and ...