Git Cheat Sheet · Explore
See the content of a commit
git show <commit>
git show <commit> displays everything you need to know about a commit: its author, its date, its message and the full diff of its changes. With no argument, it shows the last commit.
What it does
Shows the message, the author and the files changed by a commit.
A use case
You want to understand what a commit really changed before taking it elsewhere.
On the command line
git show- Last commit.
git show <commit>- A specific commit, given by its hash (the first 7 characters are enough).
git show --stat <commit>- Only the list of changed files.
git show <commit>:<file>- The file as it was at this commit.
git show HEAD~2- The commit two before the last one.
In Merathon
- Click the commit in the graph: its details and files appear on the right.
- Click a file to see its diff in the center.
- Right-click the commit → "Copy full hash", "Copy short hash" or "Copy message".
Frequently asked questions
How do I get a file as it was in an old commit?
git restore --source=<commit> <file> puts it back in the working copy; git show <commit>:<file> only displays it.