path: root/contrib
diff options
authorDenton Liu <>2021-03-03 11:16:42 (GMT)
committerJunio C Hamano <>2021-03-05 22:31:26 (GMT)
commitd3c7bf73bdb679dd98c6aff65edbce4df743ddd3 (patch)
tree7e4757674006ff07cfe29906afdc6bb8f0ec8aea /contrib
parent3e885f02775dad0d907d447bc3c24fa07870b41f (diff)
stash show: teach --include-untracked and --only-untracked
Stash entries can be made with untracked files via `git stash push --include-untracked`. However, because the untracked files are stored in the third parent of the stash entry and not the stash entry itself, running `git stash show` does not include the untracked files as part of the diff. With --include-untracked, untracked paths, which are recorded in the third-parent if it exists, are shown in addition to the paths that have modifications between the stash base and the working tree in the stash. It is possible to manually craft a malformed stash entry where duplicate untracked files in the stash entry will mask tracked files. We detect and error out in that case via a custom unpack_trees() callback: stash_worktree_untracked_merge(). Also, teach stash the --only-untracked option which only shows the untracked files of a stash entry. This is similar to `git show stash^3` but it is nice to provide a convenient abstraction for it so that users do not have to think about the underlying implementation. Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'contrib')
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4b1f426..64ef6ff 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3051,7 +3051,7 @@ _git_stash ()
__gitcomp "--name-status --oneline --patch-with-stat"
- __gitcomp "$__git_diff_common_options"
+ __gitcomp "--include-untracked --only-untracked $__git_diff_common_options"