git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] branch: implement shortcut to delete last branch

From
AGAaron Greenberg <p@aaronjgreenberg.com>
Date
Mar 23, 2018, 02:09 UTC
Message-ID
<1521770966-18383-1-git-send-email-p@aaronjgreenberg.com>

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.)

Next: Aaron Greenberg
Message 1 of 9 in “branch: implement shortcut to delete last branch”
  1. branch: implement shortcut to delete last branchAaron Greenberg, Mar 23, 2018
  2. branch: implement shortcut to delete last branchAaron Greenberg, Mar 23, 2018
  3. Jeff KingMar 23, 2018
  4. Jeff KingMar 23, 2018
  5. branch: implement shortcut to delete last branchAaron Greenberg, Mar 23, 2018
  6. branch: implement shortcut to delete last branchAaron Greenberg, Mar 23, 2018
  7. Jeff KingMar 26, 2018
  8. git@matthieu-moy.frMar 26, 2018
  9. Junio C HamanoMar 26, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.