diff options
author | Abhijit Menon-Sen <ams@toroid.org> | 2008-07-03 11:46:05 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-07-05 00:39:37 -0700 |
commit | 656b50345239293929ad8c639c5f1941c6b867ad (patch) | |
tree | 2ad9d58711dd3dc3bd5def98ccfa017f949ed102 /Documentation | |
parent | 6991357513bf8bfbb71a4675e271b386cc273476 (diff) | |
download | git-656b50345239293929ad8c639c5f1941c6b867ad.tar.gz git-656b50345239293929ad8c639c5f1941c6b867ad.tar.xz |
Implement "git stash branch <newbranch> <stash>"
Restores the stashed state on a new branch rooted at the commit on which
the stash was originally created, so that conflicts caused by subsequent
changes on the original branch can be dealt with.
(Thanks to Junio for this nice idea.)
Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-stash.txt | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 23ac33129..a4cbd0ce6 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -8,8 +8,11 @@ git-stash - Stash the changes in a dirty working directory away SYNOPSIS -------- [verse] -'git stash' (list | show [<stash>] | apply [<stash>] | clear | drop [<stash>] | pop [<stash>]) +'git stash' list +'git stash' (show | apply | drop | pop ) [<stash>] +'git stash' branch <branchname> [<stash>] 'git stash' [save [<message>]] +'git stash' clear DESCRIPTION ----------- @@ -81,6 +84,20 @@ tree's changes, but also the index's ones. However, this can fail, when you have conflicts (which are stored in the index, where you therefore can no longer apply the changes as they were originally). +branch <branchname> [<stash>]:: + + Creates and checks out a new branch named `<branchname>` starting from + the commit at which the `<stash>` was originally created, applies the + changes recorded in `<stash>` to the new working tree and index, then + drops the `<stash>` if that completes successfully. When no `<stash>` + is given, applies the latest one. ++ +This is useful if the branch on which you ran `git stash save` has +changed enough that `git stash apply` fails due to conflicts. Since +the stash is applied on top of the commit that was HEAD at the time +`git stash` was run, it restores the originally stashed state with +no conflicts. + clear:: Remove all the stashed states. Note that those states will then be subject to pruning, and may be difficult or impossible to recover. |