EGit: Pruning Remote Tracking Branches that have been Deleted on the Remote Repo

Steven Byle picture Steven Byle · Mar 4, 2013 · Viewed 16.8k times · Source

I'm using EGit (for Eclipse) with a team of devs. We have been creating a lot of feature and fix branches for new work, and then merging them into our release branches when they are completed. Right after they are merged into the correct release branch, these temporary branches are usually deleted to keep our remote repo clean.

I'm noticing that when these branches get deleted, I will fetch from our remote repo, but EGit doesn't remove them from my remote tracking view. My remote tracking view will still show deleted branches that are no longer on the remote repo (and there is no indication that they have been deleted). The only way (I have found) to have my remote tracking view reflect the actual repo is to delete all of my remote tracking branches manually (highlight and delete), and then fetch them again. This seems very roundabout, especially since you can prune remote branches via command line, like this:

git remote prune origin

Basically, what I would like to know is if there is a way to configure/make EGit perform this pruning when remote tracking branches change (after I fetch). Here is my current fetch configuration on my origin remote:

enter image description here

Answer

VonC picture VonC · Mar 5, 2013

Update March 2014: As mentioned by cheshire's answer, EGit 3.3 added that prune feature.

You can see said feature introduced in this Gerrit code review in JGit (and tested here)

The entry fetch.prune mentioned in git config can be added to your Egit configuration:

https://wiki.eclipse.org/images/f/f8/RepositoryConfigurationSettings.png


Original answer (March 2013)

EGit perform this pruning when remote tracking branches change (after I fetch).

Not that I know of.

More generally, perform any action after each fetch on the client side is not possible with hooks.
It has been requested, and was at one point implemented on the server side only: hook post-upload (run after a fetch), but removed, for security reason in a multi-user environment.