Git 查看提交歷史

在使用 Git 提交了若干更新以後,又或者克隆了某個項目,想回顧下提交歷史,咱們能夠使用 git log 命令查看。git

咱們能夠用 --oneline 選項來查看歷史記錄的簡潔的版本。url

還能夠用 --graph 選項,查看歷史中何時出現了分支、合併。如下爲相同的命令,開啓了拓撲圖spa

若是隻想查找指定用戶的提交日誌能夠使用命令:git log --author , 例如,比方說咱們要找 Git 源碼中 Linus 提交的部分日誌

若是你要指定日期,能夠執行幾個選項:--since 和 --before,可是你也能夠用 --until 和 --after。code

例如,若是我要看 Git 項目中三週前且在四月十八日以後的全部提交,我能夠執行這個(我還用了 --no-merges 選項以隱藏合併提交):orm

$ git log --oneline --before={3.weeks.ago} --after={2010-04-18} --no-merges
5469e2d Git 1.7.1-rc2
d43427d Documentation/remote-helpers: Fix typos and improve language
272a36b Fixup: Second argument may be any arbitrary string
b6c8d2d Documentation/remote-helpers: Add invocation section
5ce4f4e Documentation/urls: Rewrite to accomodate transport::address
00b84e9 Documentation/remote-helpers: Rewrite description
03aa87e Documentation: Describe other situations where -z affects git diff
77bc694 rebase-interactive: silence warning when no commits rewritten
636db2c t3301: add tests to use --format="%N"