DEV Community

Cover image for Remove branch from remote git repo
Adam K Dean
Adam K Dean

Posted on

Remove branch from remote git repo

To remove a branch from a remote git repository, you have to push an empty branch.

$ git push origin :branch-name
- [deleted]        branch-name
Enter fullscreen mode Exit fullscreen mode

If you want to also remove it from the local repo, delete the branch:

$ git checkout master 
Switch to branch 'master'

$ git branch -D branch-name
Deleted branch branch-name (was abcd123)
Enter fullscreen mode Exit fullscreen mode

We change branch as you can't delete the branch you're on.

Top comments (0)