stash: Add --include-untracked option to stash and remove all untracked files
commit787513027a7d0af3c2cd2f04b85bc7136d580586
authorDavid Caldwell <david@porkrind.org>
Sat, 25 Jun 2011 00:56:06 +0000 (24 17:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 26 Jun 2011 19:50:46 +0000 (26 12:50 -0700)
treec16ac5b585cfff301d56d1eb6b67b823cf6a18c4
parent99ac63b092f592b7181f94b6479f3a24dbfc8fdb
stash: Add --include-untracked option to stash and remove all untracked files

The --include-untracked option acts like the normal "git stash save" but
also adds all untracked files in the working directory to the stash and then
calls "git clean --force --quiet" to restore the working directory to a
pristine state.

This is useful for projects that need to run release scripts. With this
option, the release scripts can be from the main working directory so one
does not have to maintain a "clean" directory in parallel just for
releasing. Basically the work-flow becomes:

   $ git tag release-1.0
   $ git stash --include-untracked
   $ make release
   $ git clean -f
   $ git stash pop

"git stash" alone is not enough in this case--it leaves untracked files
lying around that might mess up a release process that expects everything to
be very clean or might let a release succeed that should actually fail (due
to a new source file being created that hasn't been committed yet).

Signed-off-by: David Caldwell <david@porkrind.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-stash.txt
git-stash.sh
t/t3905-stash-include-untracked.sh [new file with mode: 0755]