Re: 1.5.0.rc1.gb60d: fetch in another branch works strangely
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jan 13, 2007, 21:46 UTC
- Message-ID
- <7vr6tyk3bs.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200701132106.l0DL6BPH008314@laptop13.inf.utfsm.cl>
"Horst H. von Brand" <vonbrand@inf.utfsm.cl> writes:
> I created a new branch in the kernel to carry a not yet official patch, to > keep this up to date I do: > > $ git fetch git://git2.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
If you use longhand without colon-refspec (src:dst), then the fetch result will be in temporary ref, FETCH_HEAD. (google, or gmane search for a message on "temporary ref" and "FETCH_HEAD" by Linus for gory details). So next fetch will keep re-fetching the same thing (this has been how "fetch" was designed to work from day one and there is nothing new).
> $ git pull . origin
You do not have origin tracking branch (well, you do -have- one, but by doing the longhand without colon-refspec, you choose not to keep it up-to-date), so that would try to merge an ancient copy you obtained probably when you cloned to create the repository.
You either can do:
(1) Ad-hoc promiscuous pull without using tracking branch
$ git pull git://git.kernel.org/...../linux-2.6.git
This is good for one-shot pulling from random place when
you notice somebody you usually do not interact with has
something interesting. I do not think you would want to do
that with Linus.(2) Use remote shorthand, define and maintain tracking branch(es).
In the traditional configuration,
you would have .git/remotes/origin that says something
like:URL: git://git.kernel.org/...../torvalds/linux-2.6.git Pull: refs/heads/master:refs/heads/origin
With the newer configuration, the moral equivalent is found
in your .git/config file and would look like something like
this: [remote "origin"]
url = git://git.kernel.org/...../linux-2.6.git/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
merge = refs/heads/masterIn either way, you can update the tracking branch with:
$ git fetch origin ;# or just "git fetch"
With this, since you -do- have and -maintain- the tracking
branch, you can do after this "git fetch":$ git merge origin
to merge in what you have fetched.