I have added a bunch of files in my staging area. Now I realize that I want to commit some of those files, but not others (I want to stash the rest, actually). How can I unstage some files, but leave them in the working dir so that I can do other things with them (like stashing)? For the sake of discussion, let's say I have this git status
:
# On branch develop
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: app/scripts/vendor/ember-1.0.0-rc.5.js
# deleted: node_modules/grunt-contrib-handlebars/test/expected/partials_use_namespace.js
# modified: package.json
# modified: ../python_modules/config/settings1.py
#
Let's say I want to unstage package.json
. How can I do that? I have tried with:
git reset HEAD package.json
as suggested by git
itself, but has no effect: the file stays in the staging area (bug?).
To be clear, I do not want to loose the changes I have made to package.json
: I simply do not want to commit them yet.
EDIT
This was a mistake on my side: my git status was so big, I could not see the Changes not staged for commit heading. That is where the unstaged files have been moved to, and that is what I wanted.