Git: View History (git log)

By Xah Lee. Date: . Last updated: .

List History of Commit ID

git log -3 -- filepath
show last 3 commits of a specific file.
git log -3
show last 3 commits.

This command is important because it shows the Commit ID . You'll need to use the ID when doing git diff or other git operations. .

git log 2022-11-17 BVYCw
git log 2022-11-17

How to see last change?

git log --patch -2 --color -- filepath
show diff in last 2 commits of file.

-p or --patch means generate patch diff format.

git log --patch -2 --color
show diff in last 2 commits.
git log diff 2022-11-17 ctr4M
git log diff

Reference

git help log

Git manage