问题
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