What is the simplest way to reset all staged files in Git?

不问归期 提交于 2021-02-05 09:02:56

问题


I have used git reset before for single files but I frequently find myself having to unstage multiple files before a commit. Is there a command that unstages all staged files? I couldn't find it on the documentation (http://git-scm.com/docs/git-reset).


回答1:


git status normally shows you the options, e.g.

On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

    modified:   someFile.txt
    modified:   someDir/someOtherFile.txt

So if you want to unstage all files just do what git proposes

git reset HEAD



回答2:


Try this:

git reset HEAD .

Git should actually write what to do, when you execute git status

6:16:17 {proj_main} ~/git/proj_main$ git status
On branch proj_main
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   sub_proj/.project



回答3:


I use SourceTree client. It has option for Stage and UnStage all files. You can also use it in combination with command line.



来源:https://stackoverflow.com/questions/32204882/what-is-the-simplest-way-to-reset-all-staged-files-in-git

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