git add后 有的文件后悔 add了还没有commit 怎么办?

比如刚刚git add yourfile.cpp

想撤销的话,直接:git reset HEAD yourfile.cpp

这样add的文件 但是还没commit 的文件就恢复到原来的样子了
参考链接 :
https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E6%92%A4%E6%B6%88%E6%93%8D%E4%BD%9C

posted @ 2020-03-07 16:26  liulonglong  阅读(772)  评论(0编辑  收藏  举报