AI Hints
Home›Git & GitHub Tutorial›Reading History
Git & GitHub · Lesson 14 of 144

The Short Log

Git log --oneline.

⏱ 2 min read▶ Video at 14:10🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

The full log gets long very quickly. Most of the time, you just want a quick list. That's what dash dash one line is for.

The Short Log
From the video: The Short Log
  • The full log is long
  • Usually you want a quick list
  • --oneline

One line per commit

Git log, dash dash one line. Now each commit fits on one line. A short ID, and the message. Five commits, easy to read at a glance. Add dash n, and a number, to see only the last few. Dash n two shows just the latest two.

git
git log --oneline
f63a17a (HEAD -> main) Link to about page
ef9c947 Add basic styles
6784119 Add about page
0ba6049 Add welcome text
f7d9757 Add home page
git log --oneline -n 2
f63a17a (HEAD -> main) Link to about page
ef9c947 Add basic styles

History of one file

You can also ask for the history of a single file. Put the file name at the end. Only the commits that changed about dot HTML are shown. Just one. And for index dot HTML, three commits.

git
git log --oneline about.html
6784119 Add about page
git log --oneline index.html
f63a17a (HEAD -> main) Link to about page
0ba6049 Add welcome text
f7d9757 Add home page

Summary

git log dash dash one line gives a quick list, dash n limits it, and a file name filters it. Next, those mysterious ID codes.

Key takeaways
  • git log --oneline
  • -n 2: only the last two
  • git log <file>
Next up: What a Commit ID Is — the hash