如何在提交之前取消“git加法”?我錯誤地使用命令將文件添加到git:git add myfile.txt我還沒跑呢git commit..是否有一種方法來撤消這些文件,這樣這些文件就不會包含在提交中了嗎?
3 回答

千萬里不及你
TA貢獻1784條經驗 獲得超9個贊
git add
git reset <file>
git reset
git reset HEAD <file>
git reset HEAD
HEAD
HEAD
“git重置”(沒有選項或參數)用于在歷史上沒有任何提交時出錯,但現在它給出了一個空索引(以匹配根本不存在的提交,您甚至不打開)。

慕虎7371278
TA貢獻1802條經驗 獲得超4個贊
git status
use "git reset HEAD <file>..." to unstage
注意:最近的Git版本(1.8.4.x)更改了此消息:
(use "git rm --cached <file>..." to unstage)
- 3 回答
- 0 關注
- 496 瀏覽
添加回答
舉報
0/150
提交
取消