'upstream' branches.
- From
David Woodhouse <dwmw2@infradead.org>
- Date
- May 5, 2007, 12:29 UTC
- Message-ID
- <1178368166.11851.60.camel@pmac.infradead.org>
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/linusIs 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