Prune Remote Git Branches

October 13, 2011
Read time 1 minute

I have a newsletter! ✍

Subscribe so I can send you updates on new blog posts, videos, and anything else that I think you should know!

Git is a wonderful version control system. It’s light, nimble, and fast. It makes managing code amongst many developers a dream.

Unfortunately it has a fair share of quirks.

One of the quirkiest quirks that I’ve run into a couple times now is an issue with remote git branches.

When a remote git branch is deleted from the server your local repository doesn’t update its references.

The easy solution is to run this command:

git remote prune origin

This prunes and removes all remote branches that no longer exist.

Full credit to Dmytro Shteflyuk for this tip.

A laugh a day keeps the doctor away.
This is not professional medical advice.