From: Jeff King <peff@peff.net>
To: Aaron Greenberg <p@aaronjgreenberg.com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>, git@vger.kernel.org
Subject: Re: [PATCH] branch: implement shortcut to delete last branch
Date: Fri, 23 Mar 2018 04:56:37 -0400 [thread overview]
Message-ID: <20180323085636.GA24416@sigill.intra.peff.net> (raw)
In-Reply-To: <1521770966-18383-1-git-send-email-p@aaronjgreenberg.com>
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
next prev parent reply other threads:[~2018-03-23 8:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 2:09 [PATCH] branch: implement shortcut to delete last branch Aaron Greenberg
2018-03-23 2:09 ` Aaron Greenberg
2018-03-23 8:56 ` Jeff King [this message]
2018-03-23 9:00 ` Jeff King
2018-03-23 22:40 ` [PATCH v2] " Aaron Greenberg
2018-03-23 22:40 ` [PATCH] " Aaron Greenberg
2018-03-26 8:10 ` [PATCH v2] " Jeff King
2018-03-26 12:41 ` git
2018-03-26 16:49 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2018-03-27 18:46 [PATCH] " Aaron Greenberg
2018-03-27 18:46 ` Aaron Greenberg
2018-03-27 19:11 ` Jonathan Nieder
2018-03-27 19:23 ` Ævar Arnfjörð Bjarmason
2018-03-27 19:26 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180323085636.GA24416@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=p@aaronjgreenberg.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).