Git diff 指令快速查詢!

名詞解釋

  • Staging Area (Index)
    • 暫存區域是一個單純的檔案,一般來說放在 Git 目錄,儲存關於下一個提交的資訊。有時稱為索引(Index),但現在將它稱為暫存區域已開始成為標準。

用來比較差異的 diff 指令

比較 Working Directory 和 Staging Area

1
git diff


比較 Working Directory 和 HEAD

1
git diff head


比較 Working Directory 和該 commit 的 tree 物件

1
git diff commit


比較 Staging Area 和 HEAD

1
2
3
git diff --cached
git diff --cached head
git diff --staged


比較 Staging Area 和該 commit 的 tree 物件

1
git diff --cached commit


比較兩個 branch 之間的 HEAD

1
2
git diff branchName..branchName
git diff branchName branchName


比較 branch2 和兩個 branch 的共同祖先

1
git diff branch1...branch2


比較兩個 commit 物件下的 tree 物件

1
git diff commit commit

ngrok 的設定,來架一個臨時伺服器! 使用手機測試本機網頁狀況的方法

留言