git log walks the commit graph backward from HEAD along the parent links of Commits:
git log -1
git log --oneline
git log --oneline --stat -- dbOutput
commit e3e1df1917aa5641f6f825080c5cefe9171262dc
Author: Sam Rivera <sam@example.com>
Date: Tue Sep 22 10:20:00 2026 +0800
Add integration tests, local PostgreSQL and a README
e3e1df1 Add integration tests, local PostgreSQL and a README
15a2012 Add the Express API, PostgreSQL layer and front end
31681b8 Add npm manifest, lockfile and repository settings
15a2012 Add the Express API, PostgreSQL layer and front end
db/index.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db/schema.sql | 12 ++++++++++++
db/seed.json | 24 ++++++++++++++++++++++++
3 files changed, 96 insertions(+)-1 limits the count, --stat lists changed files, and a path after -- keeps only commits touching it. Other filters include --author=Sam, --since="2 weeks ago", --grep=PostgreSQL 1,289 , -S seed (commits adding or removing a string) and --graph (Branching and Merging); --format='%h %an %s' builds your own layout.
git show 15a2012 displays a commit with its diff, and git show HEAD~1:package.json a file as it was one commit back (HEAD~2 is two back).