Read more

Git: Remove information on branches that were deleted on origin

Arne Hartherz
March 01, 2012Software engineer at makandra GmbH

When branches get deleted on origin, your local repository won't take notice of that.

Illustration money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
Read more Show archive.org snapshot

You'll still have your locally cached versions of those branches (which is actually good) but git branch -a will still list them as remote branches.

You can clean up that information locally like this:

git remote prune origin

Your local copies of deleted branches are not removed by this.

The same effect is achieved by using (kudos to Julien Show archive.org snapshot ):

git fetch --prune

You could also set that as a default.

Posted by Arne Hartherz to makandra dev (2012-03-01 14:57)