Git: Clean up missing remote branches

A local Git repository holds a copy of any remote branch that has ever been fetched. Even though remote branches (origin/…) may already have been deleted, the local copies of these branches are kept indefinitely if we do not delete them by hand.

The following command removes missing remote branches of remote origin:

git remote prune origin

For testing purposes we may add the option –dry-run.


  • [1] git remote man page

Leave a Reply