From: Aaron Greenberg
Date: Fri, 23 Mar 2018 02:09:25 GMT Subject: [PATCH] branch: implement shortcut to delete last branch 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.)