Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338054

Summary: obsolete remote tracking branches should be deleted on fetch
Product: [Technology] EGit Reporter: Edwin Kempin <edwin.kempin>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, deepakazad, matthias.sohn, swamblumat-eclipsebugs
Version: 0.12   
Target Milestone: 3.3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Edwin Kempin CLA 2011-02-24 03:40:02 EST
Let’s say I have the following fetch specification:
remote.origin.fetch     +refs/heads/*:refs/remotes/origin/*
 
Now a new branch gets created in the central repository. 
If I do a fetch I will get a new remote tracking branch for this new branch in the central repository.
 
If I now delete the branch in the central repository and fetch again, the obsolete remote tracking is not deleted.

As default behaviour this is ok, since it does the same as git fetch on the command line. For fetch on the command line you have the option --prune which would remove the obsolete remote tracking branch. It would be nice to have this option in EGit too. It could be an option on the fetch specification or a global EGit preference (if the fetch configuration dialog should not be spoiled with too many options).
Comment 1 Deepak Azad CLA 2011-11-24 06:44:08 EST
(In reply to comment #0)
> As default behaviour this is ok, since it does the same as git fetch on the
> command line. For fetch on the command line you have the option --prune which
> would remove the obsolete remote tracking branch. It would be nice to have this
> option in EGit too. It could be an option on the fetch specification or a
> global EGit preference (if the fetch configuration dialog should not be spoiled
> with too many options).

+1. I just spent quite a bit of time wondering why I am seeing obsolete branches in JDT/Core repository on my machine. I would like to be able to 'completely replicate' a remote canonical repository on my machine, and I think that this should be the default behavior.
Comment 2 Konrad Kügler CLA 2014-02-25 13:45:19 EST
This is fixed in the upcoming 3.3 release of EGit. You can add a "fetch.prune" or a "remote.<yourremotename>.prune" key to the gitconfig and set it to "true". When you fetch, this will automatically prune branches that are deleted on the central repository.