git log

发布时间 2023-09-04 18:55:46作者: fndefbwefsowpvqfx
git log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short

Logs in Current Branch

git log

Logs last n number of commits

git log -n 5

Commits between branch1 and branch2

git log branch1..branch2

Commits in branch1 that are not in branch2

git log branch1 ^branch2

Between a Date Range

git log --since="2 weeks ago"

git whatchanged --since="2 weeks ago"

Changes by File
See a list of commits ands changes for a particular file over its history.

git log -p filename.js

Stats and Patches
The following will show statistics about commits and show the patch information as well.

git log --stat -p

search

git log --grep="Change in Commit Message"

git log -S"Change in Source Code""