How to delete local and remote branches in Git

Sep 05, 2022 · 1 min read · 11 views · Post a comment

Here’s a TL;DR version on how to delete local and remote Git branches. It’s a risk-free if you are doing it on your own repos; however, when working with other people it’s a best practice not to remove any remote branch by your own as there must be Git branch configuration and policies in place.


  • Git


Remove local Git branch:

git branch -D <branch_name>

Fetch any remote changes first then remove a remote Git branch:

git fetch --prune
git push origin --delete <branch_name>


To find more neat Git commands and hacks, browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.