Terminal GuideTerminal Guide

git show Command Guide

Show various types of objects

5 min readLast updated: January 19, 2026
Dai Aoki

Dai Aoki

CEO at init, Inc. / CTO at US & JP startups / Creator of WebTerm

Quick Reference

Commits

git showShow last commit
git show <commit>Show specific commit
git show HEAD~2Show 2 commits ago

Files

git show <commit>:<file>Show file at commit
git show :/<pattern>Show matching commit

Options

--statShow file stats
--name-onlyShow file names only
-qSuppress diff output

Downloadable Image Preview

Failed to generate preview

Basic Usage

The git show command displays detailed information about Git objects - commits, tags, trees, and blobs.

bash
# Show the last commit with diff
git show

# Show a specific commit
git show abc1234

# Show with statistics
git show --stat

Showing Commits

bash
# Show HEAD (most recent commit)
git show HEAD

# Show commit relative to HEAD
git show HEAD~1    # Previous commit
git show HEAD~3    # 3 commits ago
git show HEAD^     # Parent of HEAD

# Show by commit hash
git show abc1234

# Show commit matching message pattern
git show :/fix     # First commit with "fix" in message

# Show commit info without diff
git show -q abc1234
git show --quiet abc1234

# Show only the commit message
git show -s --format=%B abc1234

Showing File Contents

bash
# Show file at specific commit
git show abc1234:src/app.js

# Show file at HEAD
git show HEAD:package.json

# Show file from 3 commits ago
git show HEAD~3:config.json

# Show file from another branch
git show feature:src/utils.js

# Show only certain file's changes in commit
git show abc1234 -- src/app.js

Showing Tags

bash
# Show annotated tag (includes message)
git show v1.0.0

# Show tag and its commit
git show --stat v1.0.0

# List files at a tag
git show v1.0.0 --name-only
OptionDescription
--statShow file change statistics
--name-onlyShow only names of changed files
--name-statusShow names and status (A/M/D)
-q, --quietSuppress diff output
--format=<format>Custom output format

Practical Examples

bash
# Review last commit before pushing
git show

# Quick look at commit summary
git show --stat HEAD

# Get old version of a file
git show v1.0.0:src/config.js > old-config.js

# See what files changed in a commit
git show --name-only abc1234

# Check what was merged
git show --stat <merge-commit>

# View remote branch's last commit
git show origin/main

Frequently Asked Questions

What is the difference between git show and git log?

"git show" displays detailed information about a single commit (with diff). "git log" displays a list of commits. Use show for details, log for history.

How do I see a file from a specific commit?

Use "git show <commit>:<path/to/file>". For example: "git show HEAD~3:src/app.js" shows app.js as it was 3 commits ago.

How do I show only the commit message without the diff?

Use "git show -q <commit>" or "git show --quiet <commit>" to suppress the diff output and show only the commit metadata.

Can I show multiple commits at once?

Yes, specify multiple commits: "git show abc123 def456". Or use a range with git log instead for better formatting.

Summary

git show provides detailed views of commits, files, and tags. It's perfect for inspecting specific changes in your repository.

Quick Reference

  • git show - Show last commit
  • git show <commit> - Show specific commit
  • git show <commit>:<file> - Show file at commit
  • git show --stat - Show with statistics

Official Documentation

For authoritative information, refer to the official documentation:

Related Articles