Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338054 - obsolete remote tracking branches should be deleted on fetch
Summary: obsolete remote tracking branches should be deleted on fetch
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 0.12   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 3.3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-24 03:40 EST by Edwin Kempin CLA
Modified: 2014-02-25 16:00 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.