Git Purge

Post by on November 5, 2012

One of the frustrating things about Git is that there is no way to delete a branch both locally and remotely. This is exactly why I both love and hate Git: it forces you to know what you are doing. Yet, my frustration is now abated by a little script that I wrote to help me delete branches:

For reference on how to install this script, see "How to Write and Install a Custom Git Script".

Here is an example use:

$ git purge my-branch

Or, to delete multiple branches:

$ git purge my-branch-1 my-branch-2 my-branch-N

IMPORTANT! Using this script will FORCE delete the branch locally and will delete it remotely as well!

UPDATE: I have added a set of tools, including this one, to the "Git Extras" GitHub repository.

Older Posts »