'upstream' branches.

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

'upstream' branches.

From: David Woodhouse <dwmw2@infradead.org>
Date: 2016-06-15 22:43:08

When creating a repository which may pull from one or more 'upstream'
repositories, it's useful to keep 'branches' which keep track of the
last pull from those upstream repositories -- either directly or
indirectly.

At http://www.linux-mtd.infradead.org/doc/git.html I've described the
setup I'm currently using to achieve this, which looks something like
the following:

[remote "origin"]
        url = ssh://git.infradead.org/~/public_git/foo-2.6.git
        fetch = +refs/heads/*:refs/remotes/origin/*
	fetch = +refs/heads/mtd:refs/heads/mtd
	fetch = +refs/heads/linus:refs/heads/linus
        push = refs/heads/master:refs/heads/master
        push = refs/heads/mtd:refs/heads/mtd
        push = refs/heads/linus:refs/heads/linus
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "mtd"]
        url = git://git.infradead.org/mtd-2.6.git
        fetch = refs/heads/master:refs/heads/mtd
        fetch = +refs/heads/linus:refs/heads/linus
[remote "linus"]
        url = git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.$
        fetch = refs/heads/master:refs/heads/linus

Is there a better way to do this? Preferably which doesn't involve
directing the user to edit .git/config directly?

Basically, I want the local 'linus' branch to be updated whenever the
user pulls from _any_ other repository with a 'linus' branch, so that
the 'linus' branch always represents the latest commit pulled from
upstream. Likewise, the 'mtd' branch should be updated when pulling from
that tree (or any other dependent tree which will have an 'mtd' branch).

These branches should be pushed back to the origin each time.

What I have at the moment isn't ideal because I think pulling from the
'mtd' tree will fail if the 'linus' branch there is older than the local
clone's 'linus' branch. But it mostly works.

Is there a better way?

-- 
dwmw2

Re: 'upstream' branches.

From: Alex Riesen <hidden>
Date: 2016-06-15 22:43:08

David Woodhouse, Sat, May 05, 2007 14:29:26 +0200:
[remote "origin"]
        url = ssh://git.infradead.org/~/public_git/foo-2.6.git
        fetch = +refs/heads/*:refs/remotes/origin/*
	fetch = +refs/heads/mtd:refs/heads/mtd
	fetch = +refs/heads/linus:refs/heads/linus
These pluses request overwriting of the local reference even if it has
more commits than the remote ("is newer"). Are you sure you want that?
What I have at the moment isn't ideal because I think pulling from the
'mtd' tree will fail if the 'linus' branch there is older than the local
clone's 'linus' branch. But it mostly works.

Is there a better way?
I would just remove the pluses. git-fetch will say that the branch is
already up-to-date, if the local branch already has everything the
remote has.

Re: 'upstream' branches.

From: David Woodhouse <dwmw2@infradead.org>
Date: 2016-06-15 22:43:08

On Sat, 2007-05-05 at 19:44 +0200, Alex Riesen wrote:
David Woodhouse, Sat, May 05, 2007 14:29:26 +0200:
quoted
[remote "origin"]
        url = ssh://git.infradead.org/~/public_git/foo-2.6.git
        fetch = +refs/heads/*:refs/remotes/origin/*
	fetch = +refs/heads/mtd:refs/heads/mtd
	fetch = +refs/heads/linus:refs/heads/linus
These pluses request overwriting of the local reference even if it has
more commits than the remote ("is newer"). Are you sure you want that?
quoted
What I have at the moment isn't ideal because I think pulling from the
'mtd' tree will fail if the 'linus' branch there is older than the local
clone's 'linus' branch. But it mostly works.

Is there a better way?
I would just remove the pluses. git-fetch will say that the branch is
already up-to-date, if the local branch already has everything the
remote has.
Then after I pull from Linus' tree, I can't pull from the mtd tree -- it
complains that the 'linus' branch there can't be fast-forwarded, and
refuses to pull the 'master' branch.

I think what I actually want is an 'only fast-forward, but don't error
if you can't' option.

-- 
dwmw2

Re: 'upstream' branches.

From: Alex Riesen <hidden>
Date: 2016-06-15 22:43:08

David Woodhouse, Sat, May 05, 2007 19:50:28 +0200:
quoted
quoted
Is there a better way?
I would just remove the pluses. git-fetch will say that the branch is
already up-to-date, if the local branch already has everything the
remote has.
Then after I pull from Linus' tree, I can't pull from the mtd tree -- it
complains that the 'linus' branch there can't be fast-forwarded, and
refuses to pull the 'master' branch.
Which got me by surprise (just tried). I though it'd notice that all
the commits are already present...

Experts, is it really supposed to be that way?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help