O'Reilly logo

Version Control with Git by Jon Loeliger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Commit History

Viewing Old Commits

The primary command to show the history of commits is git log. It has more options, parameters, bells, whistles, colorizers, selectors, formatters, and doodads than the fabled ls. But don’t worry. Just as with ls, you don’t need to learn all the details right away.

In its parameterless form, git log acts like git log HEAD, printing the log message associated with every commit in your history that is reachable from HEAD. Changes are shown starting with the HEAD commit and working back through the graph. They are likely to be in roughly reverse chronological order, but recall Git adheres to the commit graph, not time, when traveling back over the history.

If you supply a commit à la git log commit, the log starts at the named commit and works backward. This form of the command is useful for viewing the history of a branch:

$ git log master commit 1fbb58b4153e90eda08c2b022ee32d90729582e6 Merge: 58949bb... 76bb40c... Author: Junio C Hamano <gitster@pobox.com> Date: Thu May 15 01:31:15 2008 -0700 Merge git://repo.or.cz/git-gui * git://repo.or.cz/git-gui: git-gui: Delete branches with 'git branch -D' to clear config git-gui: Setup branch.remote,merge for shorthand git-pull git-gui: Update German translation git-gui: Don't use '$$cr master' with aspell earlier than 0.60 git-gui: Report less precise object estimates for database compression commit 58949bb18a1610d109e64e997c41696e0dfe97c3 Author: Chris Frey <cdfrey@foursquare.net> Date: Wed May 14 19:22:18 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required