Your daily Git workflow

Read the project history

Use git log to inspect commits and understand how the project reached its current state.

8 minute lesson

~~~

The commit history tells you which snapshots exist and how they connect.

Start with a compact view:

git log --oneline

Each line shows an abbreviated commit ID and its subject. The newest reachable commit appears first.

To see branch and tag names beside their commits, add decorations:

git log --oneline --decorate --graph --all

--all asks Git to start from all local references, not only HEAD. --graph draws the parent relationships. It does not change history.

Inspect one commit in detail with:

git show --stat <commit-id>

Then use git show <commit-id> to inspect its patch.

History is read-only, so these are safe commands when you feel lost. If a change seems to have disappeared after switching or resetting, inspect git log --all before trying another modifying command.

Exercise: find the commit that introduced one file. Read its message, parent, and patch. Can you explain the project state before and after it?

Lesson completed

Take this course offline

Get every free book, course edition, and software download.

Get the download library →