Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

operation of DIFFs

epataky August 29, 2013

how can i do a diff from one particular commit to another .. ? also, when i do a diff on one of the commits, what is it comparing to, the previous commit? or the current file?

1 answer

1 accepted

0 votes
Answer accepted
MB
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2013

If the sourcetree is following the logic of git itself (and I see no reason why it shouldn't), then it should be like this. If you want to diff two commits, then you'll use:

git diff commit1 commit2

where commit1 and commit2 are hash values (or part of it) of each commit. Also, when doing a diff on just one of the commits, like this:

git diff commit

then you are comparing the current file with that commit and if you want to compare it to the version of the file in your HEAD, you would use:

git diff HEAD commit

and if you want to compare previous two commits, you can use:

git diff HEAD HEAD~1

(HEAD~1 means "1 commit before the HEAD", and you can use also HEAD~2, HEAD~3, etc)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events