Brainstorm's snippets (1/226)

  Deleting GIT branches

Deleting a local branch:

git branch -d feature/login

To delete a remote branch, we do not use the "git branch" command, but instead "git push" with the "--delete" flag:

git push origin --delete feature/login

If that fails because the remote branch has already been deleted, update your local list of remote branches:

git remote update origin --prune

Please keep in mind that local and remote branches actually have nothing too do with each other. They are completely separate objects in Git. Even if you've established a tracking connection (which you should for most scenarios), this still does not mean that deleting one would delete the other, too!

If you want any branch item to be deleted, you need to delete it explicitly.