#461485 git-stash: Option to save untracked and/or ignored files in stash

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
Josh Triplett
Date:
2010-05-15 21:27:06 UTC
Severity:
wishlist
#461485#3
Date:
2008-01-18 22:48:19 UTC
From:
To:
git-stash only stashes changes to tracked files.  I'd like the option
to stash new untracked files and even ignored files in the stash as
well.  This would offer several benefits:

* If my changes included adding new files, I don't want to lose or
  disturb those new files while working on whatever work required me
  to stash in the first place; I also don't want those new files
  affecting the post-stash work.  If git-stash stashed away untracked
  files, and perhaps even removed them from the working tree as it
  does for modified tracked files, I'd end up with a pristine tree
  again, and I could better separate my pre-stash and post-stash work.

* If I just built a large source tree, rebuilding it might take a
  while, even with ccache.  If I stash, then clean or rebuild the tree
  in the course of the work that required me to stash in the first
  place, I lose that time.  Furthermore, the presence of the build
  products may affect the post-stash build, unless I "make clean".
  Stashing the build products would solve this problem.

I suspect that git-stash should not do this by default.  For instance,
when using git on my home directory, I really don't want git stashing
away the gigabytes of untracked files; I suspect similar situations
arise in other repositories, where stashing untracked or ignored files
would take excessive time or disrupt files that the user wanted to
remain present.  However, I often find that I want the untracked or
ignored files stashed.  Perhaps git stash could have --untracked and
--ignored options?

- Josh Triplett