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>
3 files changed
tree: c16ac5b585cfff301d56d1eb6b67b823cf6a18c4
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. perl/
  11. po/
  12. ppc/
  13. t/
  14. templates/
  15. vcs-svn/
  16. xdiff/
  17. .gitattributes
  18. .gitignore
  19. .mailmap
  20. abspath.c
  21. aclocal.m4
  22. advice.c
  23. advice.h
  24. alias.c
  25. alloc.c
  26. archive-tar.c
  27. archive-zip.c
  28. archive.c
  29. archive.h
  30. attr.c
  31. attr.h
  32. base85.c
  33. bisect.c
  34. bisect.h
  35. blob.c
  36. blob.h
  37. branch.c
  38. branch.h
  39. builtin.h
  40. bundle.c
  41. bundle.h
  42. cache-tree.c
  43. cache-tree.h
  44. cache.h
  45. check-builtins.sh
  46. check-racy.c
  47. check_bindir
  48. color.c
  49. color.h
  50. combine-diff.c
  51. command-list.txt
  52. commit.c
  53. commit.h
  54. config.c
  55. config.mak.in
  56. configure.ac
  57. connect.c
  58. convert.c
  59. copy.c
  60. COPYING
  61. csum-file.c
  62. csum-file.h
  63. ctype.c
  64. daemon.c
  65. date.c
  66. decorate.c
  67. decorate.h
  68. delta.h
  69. diff-delta.c
  70. diff-lib.c
  71. diff-no-index.c
  72. diff.c
  73. diff.h
  74. diffcore-break.c
  75. diffcore-delta.c
  76. diffcore-order.c
  77. diffcore-pickaxe.c
  78. diffcore-rename.c
  79. diffcore.h
  80. dir.c
  81. dir.h
  82. editor.c
  83. entry.c
  84. environment.c
  85. exec_cmd.c
  86. exec_cmd.h
  87. fast-import.c
  88. fetch-pack.h
  89. fixup-builtins
  90. fsck.c
  91. fsck.h
  92. generate-cmdlist.sh
  93. gettext.c
  94. gettext.h
  95. git-add--interactive.perl
  96. git-am.sh
  97. git-archimport.perl
  98. git-bisect.sh
  99. git-compat-util.h
  100. git-cvsexportcommit.perl
  101. git-cvsimport.perl
  102. git-cvsserver.perl
  103. git-difftool--helper.sh
  104. git-difftool.perl
  105. git-filter-branch.sh
  106. git-instaweb.sh
  107. git-lost-found.sh
  108. git-merge-octopus.sh
  109. git-merge-one-file.sh
  110. git-merge-resolve.sh
  111. git-mergetool--lib.sh
  112. git-mergetool.sh
  113. git-parse-remote.sh
  114. git-pull.sh
  115. git-quiltimport.sh
  116. git-rebase--interactive.sh
  117. git-rebase.sh
  118. git-relink.perl
  119. git-remote-testgit.py
  120. git-repack.sh
  121. git-request-pull.sh
  122. git-send-email.perl
  123. git-sh-setup.sh
  124. git-stash.sh
  125. git-submodule.sh
  126. git-svn.perl
  127. GIT-VERSION-GEN
  128. git-web--browse.sh
  129. git.c
  130. git.spec.in
  131. graph.c
  132. graph.h
  133. grep.c
  134. grep.h
  135. hash.c
  136. hash.h
  137. help.c
  138. help.h
  139. hex.c
  140. http-backend.c
  141. http-fetch.c
  142. http-push.c
  143. http-walker.c
  144. http.c
  145. http.h
  146. ident.c
  147. imap-send.c
  148. INSTALL
  149. levenshtein.c
  150. levenshtein.h
  151. LGPL-2.1
  152. list-objects.c
  153. list-objects.h
  154. ll-merge.c
  155. ll-merge.h
  156. lockfile.c
  157. log-tree.c
  158. log-tree.h
  159. mailmap.c
  160. mailmap.h
  161. Makefile
  162. match-trees.c
  163. merge-file.c
  164. merge-recursive.c
  165. merge-recursive.h
  166. name-hash.c
  167. notes-cache.c
  168. notes-cache.h
  169. notes-merge.c
  170. notes-merge.h
  171. notes.c
  172. notes.h
  173. object.c
  174. object.h
  175. pack-check.c
  176. pack-refs.c
  177. pack-refs.h
  178. pack-revindex.c
  179. pack-revindex.h
  180. pack-write.c
  181. pack.h
  182. pager.c
  183. parse-options.c
  184. parse-options.h
  185. patch-delta.c
  186. patch-ids.c
  187. patch-ids.h
  188. path.c
  189. pkt-line.c
  190. pkt-line.h
  191. preload-index.c
  192. pretty.c
  193. progress.c
  194. progress.h
  195. quote.c
  196. quote.h
  197. reachable.c
  198. reachable.h
  199. read-cache.c
  200. README
  201. reflog-walk.c
  202. reflog-walk.h
  203. refs.c
  204. refs.h
  205. remote-curl.c
  206. remote.c
  207. remote.h
  208. replace_object.c
  209. rerere.c
  210. rerere.h
  211. resolve-undo.c
  212. resolve-undo.h
  213. revision.c
  214. revision.h
  215. run-command.c
  216. run-command.h
  217. send-pack.h
  218. server-info.c
  219. setup.c
  220. sha1-lookup.c
  221. sha1-lookup.h
  222. sha1_file.c
  223. sha1_name.c
  224. shallow.c
  225. shell.c
  226. shortlog.h
  227. show-index.c
  228. sideband.c
  229. sideband.h
  230. sigchain.c
  231. sigchain.h
  232. strbuf.c
  233. strbuf.h
  234. string-list.c
  235. string-list.h
  236. submodule.c
  237. submodule.h
  238. symlinks.c
  239. tag.c
  240. tag.h
  241. tar.h
  242. test-chmtime.c
  243. test-ctype.c
  244. test-date.c
  245. test-delta.c
  246. test-dump-cache-tree.c
  247. test-genrandom.c
  248. test-index-version.c
  249. test-line-buffer.c
  250. test-match-trees.c
  251. test-mktemp.c
  252. test-obj-pool.c
  253. test-parse-options.c
  254. test-path-utils.c
  255. test-run-command.c
  256. test-sha1.c
  257. test-sha1.sh
  258. test-sigchain.c
  259. test-string-pool.c
  260. test-subprocess.c
  261. test-svn-fe.c
  262. test-treap.c
  263. thread-utils.c
  264. thread-utils.h
  265. trace.c
  266. transport-helper.c
  267. transport.c
  268. transport.h
  269. tree-diff.c
  270. tree-walk.c
  271. tree-walk.h
  272. tree.c
  273. tree.h
  274. unimplemented.sh
  275. unpack-trees.c
  276. unpack-trees.h
  277. upload-pack.c
  278. url.c
  279. url.h
  280. usage.c
  281. userdiff.c
  282. userdiff.h
  283. utf8.c
  284. utf8.h
  285. walker.c
  286. walker.h
  287. wrap-for-bin.sh
  288. wrapper.c
  289. write_or_die.c
  290. ws.c
  291. wt-status.c
  292. wt-status.h
  293. xdiff-interface.c
  294. xdiff-interface.h
  295. zlib.c