Re: [PATCH] Implement "git stash branch <newbranch> <stash>"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 3, 2008, 04:12 UTC
- Message-ID
- <7v63rn61yj.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080703022316.GA25433@toroid.org>
Abhijit Menon-Sen <ams@toroid.org> writes:
Show 13 quoted lines
> +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 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.
Perhaps we would want to replay the stash always with --index for this application. By definition this will be conflict-free both in the index and in the working tree.
I've also toyed with an idea to make <branchname> optional, and detach the HEAD if <branchname> is not given. It would be a useful mode of operation but one problem is that it is _not_ an operation that should be called "branch" anymore.