How to delete references to deleted branches?

  • Page Owner: Not Set
  • Last Reviewed: 2018-11-19

I went into my project on gitlab and removed all of the "stale" branches (https://gitlab.blendinteractive.com/{group}/{project}/branches/stale). The branches still exists, however when I list out all branches (git branch -a). How do I remove the references to the deleted branches?


Additional Posts

The branches need to be pruned. Git will not clean these branches until you manually prune them.

git fetch --prune

or

git remote prune origin

Comments

  • I believe this only removes the remote references, is it worth mentioning that if you've checked out a local branch to track the remote, this command will not remove it?
  • @BobDavidson I guess the original question was in reference to remotes on gitlab. You will still have to manually remove local branches with a git branch -d {branch_name}.