Git Delete a remote branch


Example

To delete a branch on the origin remote repository, you can use for Git version 1.5.0 and newer

git push origin :<branchName>

and as of Git version 1.7.0, you can delete a remote branch using

git push origin --delete <branchName>

To delete a local remote-tracking branch:

git branch --delete --remotes <remote>/<branch>
git branch -dr <remote>/<branch> # Shorter

git fetch <remote> --prune # Delete multiple obsolete tracking branches
git fetch <remote> -p      # Shorter

To delete a branch locally. Note that this will not delete the branch if it has any unmerged changes:

git branch -d <branchName>

To delete a branch, even if it has unmerged changes:

git branch -D <branchName>