Tagged as: git linux

A repository can become cluttered with defunct branches if you don't clear them out regularly. Git allows you to delete branches easily, both locally and remotely.

To delete a branch locally:

git branch -D <branch_to_delete>

To delete a branch on the server (e.g. GitHub) where <remote> is the git remote (e.g. origin):

git push <remote> --delete <branch_to_delete>

Some older versions of git will not support this syntax, so if the above fails, you can use:

git push <remote> :<branch_to_delete>