Git: View History (git log)

By Xah Lee. Date: . Last updated: .

List History of Commit ID

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

List History of Commit ID of a Specific File

git log -3 -- myfilepath

show last 3 commits of a specific file.

How to see last change?

Show diff in last 2 commits of file

git log --patch -2 --color -- myfilepath

--patch means output in patch diff format.

Show diff in last 2 commits

git log --patch -2 --color
git log diff 2022-11-17 ctr4M
git log diff

Reference

git help log

Git manage