git show
The command that displays one object in full, usually a commit with its message and patch, or a file as it was in a given commit.
In more detail
git show HEAD~2 prints that commit and its changes; --stat summarises instead, and -s hides the patch. git show HEAD~2:parser.py prints the file exactly as it was in that commit without changing your working tree. On a tag it shows the tag details and then the commit.
Examples
git show HEAD~1:service.envgit show -s --oneline HEAD~2Related terms
- git log — The Git command that lists commits with their identifiers, authors, times and messages.
- revision — Any expression Git accepts as a name for a commit or other object, such as an ID, a branch name, a tag, HEAD or HEAD~2.
- patch — A file listing line-by-line changes to source files, and the patch command that applies or reverses them.
Taught in
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- Tags And Releases — Advanced Git Internals & Distributed Workflows