Re: [PATCH] branch: implement shortcut to delete last branch
[resending; I cc'd Matthieu on his address from that old thread, but it
bounced]
On Fri, Mar 23, 2018 at 04:56:36AM -0400, Jeff King wrote:
Show 38 quoted lines
> On Fri, Mar 23, 2018 at 02:09:25AM +0000, Aaron Greenberg wrote:
>
> > This patch gives git-branch the ability to delete the previous
> > checked-out branch using the "-" shortcut. This shortcut already exists
> > for git-checkout, git-merge, and git-revert. One of my common workflows
> > is to do some work on a local topic branch and push it to a remote,
> > where it gets merged in to 'master'. Then, I switch back to my local
> > master, fetch the remote master, and delete the previous topic branch.
> >
> > $ git checkout -b topic-a
> > $ # Do some work...
> > $ git commit -am "Implement feature A"
> > $ git push origin topic-a
> >
> > # 'origin/topic-a' gets merged into 'origin/master'
> >
> > $ git checkout master
> > $ git branch -d topic-a
> > $ # With this patch, a user could simply type
> > $ git branch -d -
> >
> > I think it's a useful shortcut for cleaning up a just-merged branch
> > (or a just switched-from branch.)
>
> I don't use "-" myself, but I can see how this would be useful. Do note
> that in a discussion last year there was some hesitation about allowing
> "-" for destructive commands:
>
> https://public-inbox.org/git/vpqh944eof7.fsf@anie.imag.fr/
>
> I don't really have a strong opinion either way.
>
> The details in this cover letter probably should go into the commit
> message. The diff itself looks OK (the assumption of a 7-char
> abbreviation in the test is a little gross, but I see you're just
> following existing convention in the file).
>
> -Peff