← 從零開始學 Git
第 5 課,共 17 課 · 10 XP
歷史:git log
理論與題目說明
機器翻譯,尚未經母語人士審閱。
git log 從新到舊顯示提交的歷史:
git log # 詳細:雜湊值、作者、日期、訊息
git log --oneline # 簡短:每個提交一行
9c1d2e3 新增測試
4b5a6f7 新增課程頁面
1a2b3c4 first commit
雜湊值的前 7 個字元就是提交的短名稱。在其他指令裡可以用它來指定提交。
在自己的電腦上也試試這些:
git log --oneline --graph --all # 直接在終端機看所有分支的圖
git log -p readme.md # 一個檔案的歷史,加上變更內容
git log --author="Kai" # 一個作者的提交
git show 4b5a6f7 # 提交到底改了什麼
題目。 連續建立三個提交:建立內容為 one 的 notes.txt(訊息 add notes),接著用 two 覆寫檔案(訊息 update notes),再用 three(訊息 final notes)。看看 git log --oneline 和圖。