ILILCode
HomeGitChanges

Reading the history

Find out what happened, when, and which line came from where — without leaving the terminal.

Lesson 5 of 9 in Git6 min1 exercise

Every commit has a hash, a parent, an author and a date. The history is the chain of those commits, and Git gives you good tools to walk it.

Four ways into the history
git log
git log --oneline

git show 1a2b3c4          # one commit, with its diff
git diff HEAD~1            # this commit against its parent
git blame notes.txt         # which commit last touched each line

git log is verbose by default: full hashes, authors, dates and messages. --oneline compresses each commit to one line — enough to scan the story before you ask for details.

Exercises

Checked in your browser · hints and solutions included

01

Exercise

A compact history

Show the commit history as one short line per commit.

terminal