* How to get rid of tracking branch?
@ 2007-02-14 13:24 Johannes Sixt
2007-02-14 13:35 ` Andy Parkins
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2007-02-14 13:24 UTC (permalink / raw)
To: git
Call me clueless, but how the heck do I get rid of a tracking remote
branch? I've cloned a repo locally, but in the clone I don't want to
track all the topic branches of the origin. But git branch -d keeps
saying it doesn't find the remote branch:
$ git version
git version 1.5.0
$ git clone mingw-git/ mingw-git2
[... all looks fine ...]
$ cd mingw-git2/
$ git branch -a
* devel
origin/HEAD
origin/devel
origin/master
origin/origin
origin/repo-devel
$ git branch -d origin/repo-devel
error: branch 'origin/repo-devel' not found.
$ git branch -d remotes/origin/repo-devel
error: branch 'remotes/origin/repo-devel' not found.
$ git branch -d heads/remotes/origin/repo-devel
error: branch 'heads/remotes/origin/repo-devel' not found.
$ git branch -d refs/heads/remotes/origin/repo-devel
error: branch 'refs/heads/remotes/origin/repo-devel' not found.
How do I delete remote branches? Do I have to
rm .git/refs/heads/remotes/origin/repo-devel
(I know I have to update the config, too, so that the next pull doesn't
draw the branch in again, but I haven't done that at this point.)
-- Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to get rid of tracking branch?
2007-02-14 13:24 How to get rid of tracking branch? Johannes Sixt
@ 2007-02-14 13:35 ` Andy Parkins
2007-02-14 17:04 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Andy Parkins @ 2007-02-14 13:35 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt
On Wednesday 2007 February 14 13:24, Johannes Sixt wrote:
> Call me clueless, but how the heck do I get rid of a tracking remote
> branch? I've cloned a repo locally, but in the clone I don't want to
> track all the topic branches of the origin. But git branch -d keeps
> saying it doesn't find the remote branch:
$ git branch -r -d origin/repo-devel
I suffered the same thing a while ago :-)
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to get rid of tracking branch?
2007-02-14 13:35 ` Andy Parkins
@ 2007-02-14 17:04 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-02-14 17:04 UTC (permalink / raw)
To: Andy Parkins; +Cc: git, Johannes Sixt
Andy Parkins <andyparkins@gmail.com> writes:
> On Wednesday 2007 February 14 13:24, Johannes Sixt wrote:
>> Call me clueless, but how the heck do I get rid of a tracking remote
>> branch? I've cloned a repo locally, but in the clone I don't want to
>> track all the topic branches of the origin. But git branch -d keeps
>> saying it doesn't find the remote branch:
>
> $ git branch -r -d origin/repo-devel
>
> I suffered the same thing a while ago :-)
I think you would also need to futz with remote.origin.fetch
that says "track all branches from remote", or your next pull
will re-create them.
You probably have
[remote "origin"]
url = ...
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
You would change it to list the branch you want to track
explicitly:
[remote "origin"]
url = ...
fetch = refs/heads/master:refs/remotes/origin/master
However, this has a subtle side effect. If you create a new
branch, say "test", running "git pull" while on "test" will
merge "master". This is not wrong per-se (it has been the
traditional git-pull behaviour and if you want to use the remote
branch that is not the one first listed on remote.origin.fetch
line, you can set up branch.test.merge yourself), but it may
surprise you because it is different when you use the globbing
refspec on the remote.origin.fetch line.
So if you want to track only two remote branches, say 'master'
and 'dev', and if you want to also have your own 'master' and
'dev' that builds on them, you would have something like:
[remote "origin"]
url = ...
fetch = refs/heads/master:refs/remotes/origin/master
fetch = refs/heads/dev:refs/remotes/origin/dev
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "dev"]
remote = origin
merge = refs/heads/dev
Then while on 'master', "git pull" will fetch from origin and
merge their 'master' in, and while on 'dev' "git pull" will
merge their 'dev' in.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-14 17:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 13:24 How to get rid of tracking branch? Johannes Sixt
2007-02-14 13:35 ` Andy Parkins
2007-02-14 17:04 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.