Given a conflicted file foo.txt
, how to tell git diff
to show changes between the base version of the file and "their" version of the file?
I can see each of the versions via git show :1:foo.txt
or git show:3:foo.txt
- is there a simple way to compare the two versions?
Concepts for resolving Git conflictsREMOTE - the head for files(s) from a remote location that you are trying to merge into your LOCAL branch. BASE - the common ancestor(s) of LOCAL and REMOTE . MERGED - the tag / HEAD object after the merge - this is saved as a new commit.
The 'ours' in Git is referring to the original working branch which has authoritative/canonical part of git history. The 'theirs' refers to the version that holds the work in order to be rebased (changes to be replayed onto the current branch).
git diff :1:foo.txt :3:foo.txt
More info at man gitrevisions; look for :[<n>:]<path>
.
Simply type git diff
and it will show only the conflicts.
Further reading: Advanced Merging
Notice the --base
and --theirs
arguments for diff
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With