🎓 A1Learner
🔍
0 of 50 lessons completed

Inspect a Commit

Show opens one snapshot. It prints the snapshot’s details and the exact lines it added.

Open the first snapshot

The plus lines are the lines the snapshot added.

$ git show 31f801f

Only the summary

The stat form skips the lines and prints the counts.

$ git show --stat HEAD

Example

$ git show 31f801f

Key points

  • Show takes a hash and prints that snapshot.
  • A short hash is enough. Git finds the full one.
  • Lines with a plus sign were added by the snapshot.
  • Lines with a minus sign were removed.
  • HEAD is the name Git gives the newest snapshot.
  • Show with HEAD opens the newest snapshot.
  • The stat form prints only the file names and counts.

Here, show opens the first snapshot. Four plus lines built the shopping list. The snapshot added a new file, so every line is new.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does git show print?