Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git compare "base" version with "theirs" version of a conflicted file?

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?

like image 754
Rafał Dowgird Avatar asked Dec 13 '11 11:12

Rafał Dowgird


People also ask

How do I use git Mergetool to resolve conflicts?

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.

What is use ours and use theirs in Gitlab?

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).


2 Answers

git diff :1:foo.txt :3:foo.txt

More info at man gitrevisions; look for :[<n>:]<path>.

like image 64
jsageryd Avatar answered Sep 27 '22 22:09

jsageryd


Simply type git diff and it will show only the conflicts.

Further reading: Advanced Merging

Notice the --base and --theirs arguments for diff

like image 32
Thomas Rawyler Avatar answered Sep 27 '22 21:09

Thomas Rawyler