During development, I routinely add working versions of files (but not commit them) to my git repo. I continue to work on those files, till they reach commitable stage, when I can commit them. So the repo looks like below
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: testfile1
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testfile1
# modified: testfile2
When I do a git stash
, and then do a git stash pop
, I get
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testfile1
# modified: testfile2
Questions
Currently, I manually do
git stash --keep-index
git stash
git stash pop
git add <stashed_files>
git stash pop
Problem with this is
Edit - I would prefer a command line solution, since I work in a similar fashion on test servers.
use --index option.
git stash
git stash pop --index