diff options
author | Thomas Gummerer <t.gummerer@gmail.com> | 2017-02-28 23:33:38 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-01 01:21:05 +0300 |
commit | df6bba0937209d679a06addd26975593fef744f2 (patch) | |
tree | a4f22b7e2d13ff8fadc931d4002136259b9a0f38 /Documentation/git-stash.txt | |
parent | 9ca6326dff29b97cfb126e6460105920c492fa15 (diff) |
stash: teach 'push' (and 'create_stash') to honor pathspec
While working on a repository, it's often helpful to stash the changes
of a single or multiple files, and leave others alone. Unfortunately
git currently offers no such option. git stash -p can be used to work
around this, but it's often impractical when there are a lot of changes
over multiple files.
Allow 'git stash push' to take pathspec to specify which paths to stash.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-stash.txt')
-rw-r--r-- | Documentation/git-stash.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index d240df4af7..88369ed8b6 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -17,6 +17,7 @@ SYNOPSIS [-u|--include-untracked] [-a|--all] [<message>]] 'git stash' push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet] [-u|--include-untracked] [-a|--all] [-m|--message <message>]] + [--] [<pathspec>...] 'git stash' clear 'git stash' create [<message>] 'git stash' store [-m|--message <message>] [-q|--quiet] <commit> @@ -48,7 +49,7 @@ OPTIONS ------- save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]:: -push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>]:: +push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--] [<pathspec>...]:: Save your local modifications to a new 'stash' and roll them back to HEAD (in the working tree and in the index). @@ -58,6 +59,12 @@ push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q only <message> does not trigger this action to prevent a misspelled subcommand from making an unwanted stash. + +When pathspec is given to 'git stash push', the new stash records the +modified states only for the files that match the pathspec. The index +entries and working tree files are then rolled back to the state in +HEAD only for these files, too, leaving files that do not match the +pathspec intact. ++ If the `--keep-index` option is used, all changes already added to the index are left intact. + |