Thanks, that is what I was looking for.  I didn't realize stash had the 
--keep-index option.

On Thursday, August 22, 2013 11:15:52 PM UTC-7, Thomas Ferris Nicolaisen 
wrote:
>
> On Friday, August 23, 2013 7:59:03 AM UTC+2, William Seiti Mizuta wrote:
>
>> You can put the not commited changes in the stash (git stash). Then you 
>> run the tests and recover the changes with git stash pop.
>>
>
> A slightly finer variation of this is to continuously stash while you keep 
> the things for the next commit in the working tree, using the --keep-index 
> parameter. This workflow is described in the docs for 
> stash<https://www.kernel.org/pub/software/scm/git/docs/git-stash.html>(but 
> note that the short form 'git stash --keep-index is sufficient):
>
>        Testing partial commits
>            You can use git stash save --keep-index when you want to make 
> two or more commits out of the
>            changes in the work tree, and you want to test each change 
> before committing:
>
>                # ... hack hack hack ...
>                $ git add --patch foo            # add just first part to 
> the index
>                $ git stash save --keep-index    # save all other changes 
> to the stash
>                $ edit/build/test first part
>                $ git commit -m 'First part'     # commit fully tested 
> change
>                $ git stash pop                  # prepare to work on all 
> other changes
>                # ... repeat above five steps until one commit remains ...
>                $ edit/build/test remaining parts
>                $ git commit foo -m 'Remaining parts'
>
> It takes a little getting used to, but it's awesome once you get into it.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to