Git 2 reference · Basics
git show Command (Git)
Show a commit's message and changes, or the contents of a file at any commit with COMMIT:PATH.
Git 2
Syntax
git show [COMMIT] [COMMIT:PATH]
Parameters
| Parameter | Description |
|---|---|
--stat |
Changed files only. |
HEAD~1:file |
A file as it was one commit ago. |
--format= |
Hide the commit header. |
Examples
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
echo 'price=9' > config.ini; git add .; git commit -q -m 'Add config'
git show --stat --format='%h %s' HEAD
Output
bd0e761 Add config config.ini | 1 + 1 file changed, 1 insertion(+)
Run this on your computer — see “Get Started” for setup.
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
echo v1 > app.txt; git add .; git commit -q -m v1
echo v2 > app.txt; git commit -q -am v2
git show HEAD~1:app.txt
Output
v1
Run this on your computer — see “Get Started” for setup.
Related
git log· Show commit history: one line per commit, as a graph, filtered by author, date, path or message.git diff· Show changes: working tree versus staging area, staged changes (--staged), or between commits and branches.- Viewing History and Differences · tutorial