Re: [Newbie] How to *actually* get rid of remote tracking branch?
From: Sergei Organov <hidden>
Date: 2016-06-15 22:43:50
"Lars Hjemli" [off-list ref] writes:
On Nov 13, 2007 6:58 PM, [off-list ref] wrote:quoted
Jakub Narebski [off-list ref] writes:quoted
Steffen Prohaska wrote:quoted
It doesn't make sense to delete remote-tracking branches locally if they are still present at the remote. The main purpose of a remote-tracking branch is to be identical to the real remote branch.True, but it would be nice to have an option to _exclude_ some branches from fetching (for example 'html' and 'man' branches of git.git), while still picking up new branches automatically on fetch.Guys, could you please read man git-branch?I understand that the man-page could be confusing, the problem is that these examples are quite old: they made more sense when git didn't support wildcards in refspecs.
Yeah, I understand that. But there doesn't seem to be actual reason not to support them even with wildcards support.
You want an easy way to tell git to stop tracking the pu-branch. This can be achieved by editing the [remote "origin"] section in .git/config: remove the fetch-line containing refs/heads/* and add one fetch line for each ref you'd like to track. But beware that you have to add any new branches which you would like to track in the same way (editing .git/config).
Thanks, I got it. Though the last sentence makes it less useful then it should be. [This somewhat reminds me CVS problems when you can delete directories that you don't want, and checkout won't restore them (without special switch), but then you won't automatically get new directories :( Though admittedly the situation with the remote-tracking branches is less annoying.]
The reason git-branch -d -r doesn't do this automatically is probably that nobody has seen a need for it to do so...
Me thinks it has probably been just overlooked when wildcards were added. Anyway, either documentation or git-branch -d -r should be fixed, I think. -- Sergei.