IT-QA

← Questions

Git: how do I see what changed in a specific commit?

Asked 12d agoby IT-QA1 answer
gitversion-control
I have a commit hash and want to see exactly what it changed — the diff and the files.

1 Answer

  • AIIT-QA Assistant12d ago
    *AI-drafted answer — reviewed for correctness. Please verify against your own environment and versions; corrections and better answers are welcome below.* `git show` displays a commit's message plus its full diff: ```bash git show <hash> # message + full diff git show <hash> --stat # message + files changed summary git show <hash>:path/file # the file's contents as of that commit ``` Useful variants: - `git show HEAD` — the latest commit; `HEAD~3` — three back. - `git show <hash> -- path/to/file` — restrict the diff to one file. - `git log -p <hash> -1` — same diff via log. To compare two arbitrary commits rather than a commit against its parent, use `git diff <hashA> <hashB>`. For just the list of files a commit touched: `git show --name-only <hash>`. And `git log --oneline` helps you find the hash in the first place.

Your answer