🎓 A1Learner
🔍
0 of 50 lessons completed

View the Log

The log lists every snapshot in order. The newest sits at the top.

The full log

Each entry shows the hash, the author, the date, and the message.

$ git log

One line per snapshot

The short form is the one you will use most.

$ git log --oneline

Only the last two

A number limits the list to the newest snapshots.

$ git log --oneline -2

Example

$ git log --graph --oneline

Key points

  • Each entry shows its hash, its author, its date, and its message.
  • The author is the name and email from the settings.
  • The date is the time the snapshot was saved.
  • The short form lists one line per snapshot.
  • The graph form draws the lines between snapshots.
  • A number after the command limits the list.
  • The log never changes history. It only reads it.

Here, the graph draws one star per snapshot. The stars sit in a straight line because the work has no branches yet.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

Which command lists the snapshots?