* Pulling peer's branch and getting tracking branch created
@ 2007-02-27 0:37 Bill Lear
2007-02-27 0:59 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Bill Lear @ 2007-02-27 0:37 UTC (permalink / raw)
To: git
I can't seem to figure out the correct magic to get my buddy's branch,
and create the appropriate tracking branch at the same time without
doing a clone.
I don't want to branch from my master, just get his branch and the
matching tracking branch...
It's been a long day, so sorry for the simplistic question, but how
do I do this exactly?
Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pulling peer's branch and getting tracking branch created
2007-02-27 0:37 Pulling peer's branch and getting tracking branch created Bill Lear
@ 2007-02-27 0:59 ` Junio C Hamano
2007-02-27 1:04 ` Bill Lear
2007-02-27 1:07 ` Bill Lear
0 siblings, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-02-27 0:59 UTC (permalink / raw)
To: Bill Lear; +Cc: git
Bill Lear <rael@zopyra.com> writes:
> I can't seem to figure out the correct magic to get my buddy's branch,
> and create the appropriate tracking branch at the same time without
> doing a clone.
I'll cheat and ask "git show b6f5da1e" ;-).
$ git remote add -f -m master bob ../bob.git/
which should add:
[remote "bob"]
url = ../bob.git/
fetch = +refs/heads/*:refs/remotes/bob/*
to .git/config, and perform the initial "git fetch bob" so that
bob's heads appear under your .git/refs/remotes/bob/*, iow,
after this, you can ask:
$ git branch -r
bob/HEAD
bob/master
bob/topic-1
bob/topic-2
...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pulling peer's branch and getting tracking branch created
2007-02-27 0:59 ` Junio C Hamano
@ 2007-02-27 1:04 ` Bill Lear
2007-02-27 1:06 ` Junio C Hamano
2007-02-27 1:07 ` Bill Lear
1 sibling, 1 reply; 7+ messages in thread
From: Bill Lear @ 2007-02-27 1:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Monday, February 26, 2007 at 16:59:27 (-0800) Junio C Hamano writes:
>Bill Lear <rael@zopyra.com> writes:
>
>> I can't seem to figure out the correct magic to get my buddy's branch,
>> and create the appropriate tracking branch at the same time without
>> doing a clone.
>
>I'll cheat and ask "git show b6f5da1e" ;-).
>
> $ git remote add -f -m master bob ../bob.git/
>
>which should add:
>
> [remote "bob"]
> url = ../bob.git/
> fetch = +refs/heads/*:refs/remotes/bob/*
>
>to .git/config, and perform the initial "git fetch bob" so that
>bob's heads appear under your .git/refs/remotes/bob/*, iow,
>after this, you can ask:
>
> $ git branch -r
> bob/HEAD
> bob/master
> bob/topic-1
> bob/topic-2
Ok, and then:
% git checkout -b topic-1 bob/topic-1
Gets me onto a topic branch ...
So, this does do what I've asked, and more: however, how can I get it
to do only the one branch that I want and not all of the others? If
this part is really annoyingly hard and/or stupid, don't hesitate to
say so.
Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pulling peer's branch and getting tracking branch created
2007-02-27 1:04 ` Bill Lear
@ 2007-02-27 1:06 ` Junio C Hamano
0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-02-27 1:06 UTC (permalink / raw)
To: Bill Lear; +Cc: git
Bill Lear <rael@zopyra.com> writes:
> On Monday, February 26, 2007 at 16:59:27 (-0800) Junio C Hamano writes:
>>Bill Lear <rael@zopyra.com> writes:
>>
>>> I can't seem to figure out the correct magic to get my buddy's branch,
>>> and create the appropriate tracking branch at the same time without
>>> doing a clone.
>>
>>I'll cheat and ask "git show b6f5da1e" ;-).
>>
>> $ git remote add -f -m master bob ../bob.git/
>>
>>which should add:
>>
>> [remote "bob"]
>> url = ../bob.git/
>> fetch = +refs/heads/*:refs/remotes/bob/*
>>
>>to .git/config, and perform the initial "git fetch bob" so that
>>bob's heads appear under your .git/refs/remotes/bob/*, iow,
>>after this, you can ask:
>>
>> $ git branch -r
>> bob/HEAD
>> bob/master
>> bob/topic-1
>> bob/topic-2
>
> Ok, and then:
>
> % git checkout -b topic-1 bob/topic-1
>
> Gets me onto a topic branch ...
>
> So, this does do what I've asked, and more: however, how can I get it
> to do only the one branch that I want and not all of the others? If
> this part is really annoyingly hard and/or stupid, don't hesitate to
> say so.
This time, I'll cheat and ask you to ask "git show b6f5da1e"
;-).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pulling peer's branch and getting tracking branch created
2007-02-27 0:59 ` Junio C Hamano
2007-02-27 1:04 ` Bill Lear
@ 2007-02-27 1:07 ` Bill Lear
2007-02-27 1:13 ` Junio C Hamano
1 sibling, 1 reply; 7+ messages in thread
From: Bill Lear @ 2007-02-27 1:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Monday, February 26, 2007 at 16:59:27 (-0800) Junio C Hamano writes:
>Bill Lear <rael@zopyra.com> writes:
>
>> I can't seem to figure out the correct magic to get my buddy's branch,
>> and create the appropriate tracking branch at the same time without
>> doing a clone.
>
>I'll cheat and ask "git show b6f5da1e" ;-).
>
> $ git remote add -f -m master bob ../bob.git/
Sorry, should have asked: what doe "-f -m master" mean? I looked in
the man page, but didn't see anything on this.
Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pulling peer's branch and getting tracking branch created
2007-02-27 1:07 ` Bill Lear
@ 2007-02-27 1:13 ` Junio C Hamano
2007-02-27 1:24 ` Bill Lear
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-02-27 1:13 UTC (permalink / raw)
To: Bill Lear; +Cc: git
Bill Lear <rael@zopyra.com> writes:
> On Monday, February 26, 2007 at 16:59:27 (-0800) Junio C Hamano writes:
>>Bill Lear <rael@zopyra.com> writes:
>>
>>> I can't seem to figure out the correct magic to get my buddy's branch,
>>> and create the appropriate tracking branch at the same time without
>>> doing a clone.
>>
>>I'll cheat and ask "git show b6f5da1e" ;-).
>>
>> $ git remote add -f -m master bob ../bob.git/
>
> Sorry, should have asked: what doe "-f -m master" mean? I looked in
> the man page, but didn't see anything on this.
I should be the one who's saying sorry. I realized it was not
documented and updated the doc last night. Here is an excerpt:
'add'::
Adds a remote named <name> for the repository at
<url>. The command `git fetch <name>` can then be used to create and
update remote-tracking branches <name>/<branch>.
With `-f` option, `git fetch <name>` is run immediately after
the remote information is set up.
With `-t <branch>` option, instead of the default glob
refspec for the remote to track all branches under
`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
is created. You can give more than one `-t <branch>` to track
multiple branche without grabbing all branches.
With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
up to point at remote's `<master>` branch instead of whatever
branch the `HEAD` at the remote repository actually points at.
But I realize that the commit log message of b6f5da should
probably be massaged into the EXAMPLES section.
commit b6f5da1e0f4eeb59798b320f97d27f83d19f89df
Author: Junio C Hamano <junkio@cox.net>
Date: Thu Feb 1 23:30:03 2007 -0800
Teach git-remote add to fetch and track
This adds three options to 'git-remote add'.
* -f (or --fetch) option tells it to also run the initial "git
fetch" using the newly created remote shorthand.
* -t (or --track) option tells it not to use the default
wildcard to track all branches.
* -m (or --master) option tells it to make the
remote/$name/HEAD point at a remote tracking branch other
than master.
For example, with this I can say:
$ git remote add -f -t master -t quick-start -m master \
jbf-um git://linux-nfs.org/~bfields/git.git/
to
(1) create remote.jbf-um.url;
(2) track master and quick-start branches (and no other); the
two -t options create these two lines:
fetch = +refs/heads/master:refs/remotes/jbf-um/master
fetch = +refs/heads/quick-start:refs/remotes/jbf-um/quick-start
(3) set up remotes/jbf-um/HEAD to point at jbf-um/master so
that later I can say "git log jbf-um"
Or I could do
$ git remote add -t 'ap/*' andy /home/andy/git.git
to make Andy's topic branches kept track of under refs/remotes/andy/ap/.
Other possible improvements I considered but haven't implemented
(hint, hint) are:
* reject wildcard letters other than a trailing '*' to the -t
parameter;
* make -m optional and when the first -t parameter does not
have the trailing '*' default to that value (so the above
example does not need to say "-m master");
* if -m is not given, and -t parameter ends with '*' (i.e. the
above defaulting did not tell us where to point HEAD at), and
if we did the fetch with -f, check if 'master' was fetched
and make HEAD point at it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pulling peer's branch and getting tracking branch created
2007-02-27 1:13 ` Junio C Hamano
@ 2007-02-27 1:24 ` Bill Lear
0 siblings, 0 replies; 7+ messages in thread
From: Bill Lear @ 2007-02-27 1:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Monday, February 26, 2007 at 17:13:27 (-0800) Junio C Hamano writes:
>Bill Lear <rael@zopyra.com> writes:
>> On Monday, February 26, 2007 at 16:59:27 (-0800) Junio C Hamano writes:
>>>
>>> $ git remote add -f -m master bob ../bob.git/
>>
>> Sorry, should have asked: what doe "-f -m master" mean? I looked in
>> the man page, but didn't see anything on this.
>
>I should be the one who's saying sorry. I realized it was not
>documented and updated the doc last night. Here is an excerpt:
No problems. As usual, superlative support here on the git list.
Thanks very much.
Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-02-27 1:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 0:37 Pulling peer's branch and getting tracking branch created Bill Lear
2007-02-27 0:59 ` Junio C Hamano
2007-02-27 1:04 ` Bill Lear
2007-02-27 1:06 ` Junio C Hamano
2007-02-27 1:07 ` Bill Lear
2007-02-27 1:13 ` Junio C Hamano
2007-02-27 1:24 ` Bill Lear
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.