Git: View History/Log

By Xah Lee. Date: . Last updated: .

How to get a history of commits?

#show last 2 commits
git log -2
git log screenshot 2017 06 16
git log screenshot

This command is important because it shows the ID for each commit. You'll need to use the ID when doing comparisons or diff or revert.

[see Git: Diff Between {Working Dir, Staged Area, Last Commit}]

[see Git: Revert Change]

How to see last change?

# show diff of last changes
git log -p -2 --color
git log diff 2017 06 16 688ce
git log diff

git help log

If you have a question, put $5 at patreon and message me.


  1. Install git
  2. Git Basics
  3. Git Ignore File
  4. Commit Files
  5. Push to Server
  6. Pull from Server
  7. Find Difference
  8. View Log
  9. Revert Change
  10. Branching
  11. Temp Save: git stash
  12. What's HEAD
  13. FAQ