What is git show?

Why Interviewers Ask This

This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Git & GitHub topics. It also reveals how well you can explain technical ideas to non-experts.

Answer

git show displays information about a specific Git object — most commonly used to view a commit's metadata and diff. For commits: git show — show the last commit; git show abc1234 — show a specific commit (hash, author, date, message, and full diff); git show HEAD~2 — show the commit 2 back from HEAD. Output: commit metadata at the top, followed by the diff (+ added lines, - removed lines). Options: --stat — show only file change summary, not full diff; --no-patch — show only commit message, no diff; git show abc1234:src/app.js — show the contents of a file at a specific commit (useful for viewing old versions without checking out). For tags: git show v1.0 — show tag info + the tagged commit. For trees/blobs: git show abc1234^{tree} — show the tree object. Difference from git log -p: git show shows one commit in detail; git log -p shows many commits with their diffs. git show is ideal when you know the exact commit hash and want full details.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Git & GitHub answers easy to follow.