Review commit history using Git log

Review commit history using Git log

Git log is a handy command that helps us track commit history.

It provides various arguments and yet they are not equally valuable for practice.

This post demonstrates hot options of the git log command you don't wish to miss.

Show the difference in each commit

$ git log -p -1        

'-p' or '--patch' allows us to watch the difference in each commit.

'-1' limits the log entries to the last one. You can choose another integer.

Print a list of modified files for each commit

$ git log -p --stat        

Format log output

$ git log --pretty=online        

'=online' indicates a given format

Limit log output

Show commits only within a specified time window

$ git log --since=2.weeks        

Show commits that only change the specified function

$ git log -S 'function_name'        

Show commits that only change the specified file(s)

$ git log --<path to files>        

要查看或添加评论,请登录

Xin (David) Zhao的更多文章

社区洞察

其他会员也浏览了