0

I can show the history that changed files at specify hash using Github or Git Tools(SourceTree, SmartGit).

How can I show the history that changed files at specify hash using Git command?

Github

1
  • 2
    git show <hash>
    – joanis
    Mar 10, 2021 at 19:19

1 Answer 1

2

You can show the commit SHAs which have affected a given file with git-log and show those changes with git-show as @joanis suggests:

git log <path>

git show <hash> <path>

You may also show this output using git-diff. This might be more helpful if you would like to see the changes on a file over multiple commits rather than a single one at the cost of being more verbose:

# changes made by the commit
git diff <hash>~ <hash> <path>

# changes made by the commit and the previous one
git diff <hash>~2 <hash> <path>

See this question for more info about referencing previous commits

1
  • 1
    git show is basically an alias for git log -1 --patch, the shortest rendition for a single commit would be git log -1 -m -p -- path, with -m to get the patch even for merges.
    – jthill
    Mar 10, 2021 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.