如何在提交前撤消'git add'? - How do I undo 'git add' before commit?

問題:

Want to improve this post? 想要改善這篇文章嗎? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. 提供此問題的詳細答案,包括引文和爲何答案正確的解釋。 Answers without enough detail may be edited or deleted. 答案不夠詳細的答案可能會被編輯或刪除。 git

I mistakenly added files to Git using the command: 我錯誤地使用如下命令將文件添加到了Git: ide

git add myfile.txt

I have not yet run git commit . 我尚未運行git commit Is there a way to undo this, so these files won't be included in the commit? 有一種方法能夠撤消此操做,以便這些文件不會包含在提交中? post


解決方案:

參考一: https://stackoom.com/question/1SZe/如何在提交前撤消-git-add
參考二: https://oldbug.net/q/1SZe/How-do-I-undo-git-add-before-commit
相關文章
相關標籤/搜索