Git delete branch tool
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit behind elliottcarlson:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Delete local and remote git branches.

Delete one or more branches both locally and remotely.


$ git delete-branch [branchname1] [branchnameX]

Example output:

$ git delete-branch [branchname]
[branchname] branch last updated: 8 weeks ago
Are you sure you want to delete the local [branchname] branch? <Y>es or <N>o
Local branch [branchname] deleted.
Are you sure you want to delete the remote [branchname] branch? <Y>es or <N>o
Remote branch [branchname] deleted.


Simply copy this script into a directory on your path (/usr/local/bin for example) and then give it executable permissions (chmod 755 /usr/local/bin/git-delete-branch).

Optional git branch tab completion.

This depends on the standard script available commonly on the Internet. Just add this to the file and get auto-completion of branch names.

    _git_delete_branch ()
        __git_complete_strategy && return
        __gitcomp_nl "$(__git_refs)"