Reputation: 116
With svn and Cornerstone this is trivial, but I can't seem to find a way to do it with Git or sourcetree (Atlassians excellent visual git tool for mac sourcetreeapp).
I need to compare two commits on the same branch that are several versions apart. Cornerstone lets me pick any version or tag and compare against my working directory but I can't seem to find a way to get sourcetree, or with git diff and filemerge (opendiff) to do this.
E.g.
working dir HEAD
change three
change two
change one Tag: works
I need to compare HEAD
and works
but I can't seem to find a way to do this. I can't even check out a file from works
like I can in SVN, it wants to pull the whole repository at that version and wipe out my working directory. If I could get the files side by side I could run opendiff or another tool.
What am I missing?
Upvotes: 0
Views: 1047
Reputation: 129654
Run gitk --all
Select the first commit.
Right click the second commit and select "diff this to selected"
Or you can do that in the command line with git diff.
Upvotes: 0
Reputation: 46444
git diff <commit hash1> <commit hash2>
. git diff <commit hash1> <commit hash2> -- file/path
git checkout <commit hash> -- file/path
. Note: You can substitute <commit hash>
with any tag, branch, etc.
Upvotes: 2