Reputation: 61578
To compare a file with a certain commit that is not the current HEAD, I call git log
, note the commit hash and then call git diff <hash> filename
.
Is there a way to use the diff command like this: git diff -<x_commits_back> filename
and compare the file with a version from x
versions ago?
Thank you
Upvotes: 1
Views: 73
Reputation: 793027
Yes, you can use:
git diff HEAD~X -- filename
Replace X
as appropriate. Note that it follows the first parent of merge commits.
Upvotes: 5