Undo multiple file and folder 'git add' [duplicate]

狂风中的少年 提交于 2020-12-29 05:18:26

问题


I executed

git add .

and now I want to revert that git add. How can I accomplish that?


回答1:


git reset (which is equivalent to git reset HEAD) will un-add (more commonly "unstage") all files.

In Git, revert is used for undoing an existing commit (typically a commit that happened a while ago, or has been shared with others). If your commit has not yet been shared with others, there are ways to "rewrite" recent history such that you can pretend the changes you want to revert never happened in the first place.




回答2:


You can unstage all snapshots with git reset HEAD or selectively unstage paths with git reset HEAD -- <filepath>.



来源:https://stackoverflow.com/questions/18424943/undo-multiple-file-and-folder-git-add

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!