git show
Display detailed information about commits, tags, or other Git objects, showing exactly what changed.
You want to see exactly what changed in a specific commit, or examine a tag's
details, or review the content of a file at a particular point in history.
git show displays detailed information about Git objects—commits, tags, trees,
or blobs—making it the go-to command for inspecting specific points in your
repository's history.
Running git show without arguments shows the most recent commit with its
metadata (author, date, message) and the full diff of what changed. It's like
combining git log -1 and git diff for the latest commit. To see a specific
commit, use its SHA: git show abc123 displays that commit's details and
changes.
You can show specific files from a commit with
git show abc123:path/to/file.js, which outputs the file's content as it
existed in that commit. This is useful when you want to see what a file looked
like at a specific point without checking out that commit. You can redirect this
to a file with git show abc123:old-file.js > recovered-file.js to recover
deleted files or old versions.
When examining tags, git show v1.0.0 displays the tag object's metadata (if
it's an annotated tag) or the commit it points to (if it's a lightweight tag).
This is how you see release notes or verify what version a tag represents.
In pull request workflows, show helps you review individual commits during code
review. When someone's PR has ten commits and you want to understand what each
one did, you can git show each commit hash to see its isolated changes. This
is often clearer than looking at the full branch diff because it shows the
logical progression of work.
Understanding show means having a quick way to inspect any Git object. It's the command for "show me what this is" when you have a SHA, tag name, or file reference and want to see the details.
