Git 筆記 (3-2) 修改 git add 後的檔案

Git 筆記


修改 git add 後的檔案可分成下面兩種情況:

1. 檔案庫尚無任何檔案 (尚未 commit 過)

$ git rm --cached 檔案名稱

把在 Staging Area 中的檔案移出 Staging Area 並還原成 untracked 的狀態


2. 檔案庫有儲存檔案 (已經 commit 過了)

$ git reset HEAD 檔案名稱

把在 Staging Area 中的檔案移出 Staging Area 並還原成最近的 commit 狀態 (通常是 tracked)

留言

熱門文章