git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] stash: --[no-]include-untracked option for create

From
Marc Strapetz <marc.strapetz@syntevo.com>
Date
Jan 3, 2017, 15:53 UTC
Message-ID
<20170103155356.11213-2-marc.strapetz@syntevo.com>
In-Reply-To
<20170103155356.11213-1-marc.strapetz@syntevo.com>

Expose internal option to include untracked files for the stash 'create' subcommand.

Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
---
 Documentation/git-stash.txt |  2 +-
 git-stash.sh                | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 2e9cef06e..cc7944e59 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -16,7 +16,7 @@ SYNOPSIS
 'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
 	     [-u|--include-untracked] [-a|--all] [<message>]]
 'git stash' clear
-'git stash' create [<message>]
+'git stash' create [-u|--[no-]include-untracked] [<message>]
 'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
 
 DESCRIPTION
diff --git a/git-stash.sh b/git-stash.sh
index c6b9db694..16f5fe93e 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -10,7 +10,7 @@ USAGE="list [<options>]
    or: $dashless [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
 		       [-u|--include-untracked] [-a|--all] [<message>]]
    or: $dashless clear
-   or: $dashless create [<message>]
+   or: $dashless create [-u|--[no-]include-untracked] [<message>]
    or: $dashless store [-m|--message <message>] [-q|--quiet] <commit>"
 
 SUBDIRECTORY_OK=Yes
@@ -629,7 +629,17 @@ clear)
 	;;
 create)
 	shift
-	create_stash "$*" && echo "$w_commit"
+	case "$1" in
+	-u|--include-untracked)
+		untracked=untracked
+		shift
+		;;
+	--no-include-untracked)
+		untracked=
+		shift
+		;;
+	esac
+	create_stash "$*" "$untracked" && echo "$w_commit"
 	;;
 store)
 	shift
-- 
2.11.0
Previous: Marc StrapetzNext: Junio C Hamano
Message 2 of 3 in “stash: fix USAGE text”
  1. 1/2 stash: fix USAGE textMarc Strapetz, Jan 3, 2017
  2. 2/2 stash: --[no-]include-untracked option for createMarc Strapetz, Jan 3, 2017
  3. Junio C HamanoJan 9, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.