EN
Git - print changes between specific commits (print changed lines using git-diff)
8 points
In this short article, we would like to show how to print changes between specific commits.
Quick solution:
xxxxxxxxxx
1
git diff COMMIT-1-HASH..COMMIT-2-HASH
2
3
# e.g. git diff f44a5df0..e259699e
Hint: use
git log --oneline
command to see commits.
Let's suppose we get commit list using git log --oneline
:
xxxxxxxxxx
1
...
2
a56a9bdb created index.html
3
b956daab added better styles for the site header
4
3d658ac3 added better styles for the site footer
5
706d93a0 created home page
6
e2091d8b created contact page
7
f44a5df0 created about page
8
e259699e fixed title in the index.html
9
538a3d6c added better styles for the site content
10
...
Let's suppose we want to check changes between commmits: f44a5df0
and e259699e
:
xxxxxxxxxx
1
$ git diff f44a5df0..e259699e
Example output:

As we can see there are only some changes related to title update.