git: deleting remote tracked branches

Since I’m always DuckDuckGo-ing for these information, I’ll set a note here for future reference and for all of you, fellow readers.

Situation: one (or more) remote-tracked git branches got deleted (either locally or remote). You are in either one of the two cases following:

  • you have deleted the local branch and you want to delete that branch in the remote too. What you want is:

git push <remote> :<deleted_branch>

  • someone (you or other allowed members on the remote) has deleted a remote branch. To delete all stale remote-tracked branches for a given remote:

git remote prune <remote>

Leave a Reply

Your email address will not be published. Required fields are marked *