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:
git diff COMMIT-1-HASH..COMMIT-2-HASH
# e.g. git diff f44a5df0..e259699e
Hint: use
git log --oneline
command to see commits.
Practical example
Let's suppose we get commit list using git log --oneline
:
...
a56a9bdb created index.html
b956daab added better styles for the site header
3d658ac3 added better styles for the site footer
706d93a0 created home page
e2091d8b created contact page
f44a5df0 created about page
e259699e fixed title in the index.html
538a3d6c added better styles for the site content
...
Let's suppose we want to check changes between commmits: f44a5df0
and e259699e
:
$ git diff f44a5df0..e259699e
Example output:
As we can see there are only some changes related to title update.