Much like Diff, git allows you to compare files between different commits. Instead of comparing two currently existing files, it will compare files across two commits. The call is similar:
git diff HASH1 HASH2
where HASH1
is the reference commit (commit1), and HASH2
is the commit being looked at. This means lines present in a file at commit1 but not commit2 will have a leading -
as they were removed, while lines in commit2 but not in commit1 will have a leading +
. Note that this will go through all the files that have changed between commit1 and commit2.
Useful Options
- --name-only
- To see only the name of files that have changed between commits.