[cairo] Maintaining cairo with git

Carl Worth cworth at cworth.org
Fri Feb 17 18:28:07 PST 2006


On Thu, 16 Feb 2006 17:54:00 -0800, Carl Worth wrote:
>
> So, to get started I suggest cloning from the central tree:
> 
> 	git clone git+ssh://git.cairographics.org/git/cairo
> 
> and things that you want to push back to it should be committed to the
> "master" branch locally and can then be pushed up with:
> 
> 	git push origin

I'm no longer recommending the above for anyone that wants to publish
a personal cairo tree. See gory details[*] if you're interested.

If you want to follow my scheme, here's how I've setup my tree (for
now---it could all change again next week I supposed). I did clone as
above, but then I moved .git/remotes/origin to .git/remotes/cairo and
I modified it to look like this:

	$ cat .git/remotes/cairo
	URL: git.cairographics.org:/git/cairo
	Pull: master:cairo-origin
	Pull: BRANCH_1_0:BRANCH_1_0-origin
	Push: cairo:master
	Pull: BRANCH_1_0:BRANCH_1_0

Then, after a "git pull cairo" I get a branch named "cairo-origin" and
I can create a branch named cairo off of it for doing commits to be
pushed upstream:

	git checkout -b cairo cairo-origin

To commit something to the central cairo tree, I commit it on my cairo
branch and then push that with:

	git push cairo

Then, for my own testing, I'll have a bunch of feature-based branches
as well as one branch named "cworth" that merges in all of those that
I'm testing at any given point. So that's easy enough to create off of
the cairo branch:

	git checkout -b cworth cairo

And I want this merged tree of features-in-testing to be what people
think of as "cworth's version of cairo" or what they get when they
clone from ~cworth/cairo. So that means I want it to appear there as
"master". So I setup .git/remotes/cworth like so:

	$ cat .git/remotes/cworth
	URL: git.cairographics.org:~cworth/cairo
	Push: cworth:master

and I can push my commits out to it with:

	git push cworth --all

(The extra "--all" here also advertises all of the various branches I
have in my repository.)

After setting that up, I don't need any "master" or "origin" branch
names, which might just be confusing in this two-upstream-repository
system, so I just delete those:

	git branch -d master
	git branch -d origin

But I do remember that I should never commit to any -origin branch,
(such as cairo-origin or BRANCH_1_0-origin), but to the corresponding
branch without -origin.

-Carl

[*] Gory details:

There's some subtle stuff going on after a default clone, and with
"git push origin". Here's the deal. The clone creates a remote named
origin with the following pull specifications:

	Pull: master:origin
	Pull: BRANCH_1_0_:BRANCH_1_0

and also creates a local branch named "master" and makes it the
current branch.

So, the remote "master" is renamed to "origin" locally, while the
local "master" is quite independent.

One can do similar local->remote renamings during a push, such as:

	git push origin local:remote

or by listing them on Push: lines in a remotes file. So the
interesting question is, what does "git push origin" do with no branch
names on the command-line nor in any Pull: line of the remotes file?

Well, it's not documented in the git-push documentation, (though it is
in git-send-pack), but what it does is find all refs with the same
local and remote names and sync those up.

But in my scheme I need to manage a remote "master" for cairo's
central tree and a remote "master" for my personal tree. So this
automatic matching of a local "master" is not helpful, and relying on
it for either just seems confusing or dangerous. (Though the default
is convenient when working with only a single remote repository.)

Meanwhile, the way "git fetch" and "git pull" work, one should never
commit to any local branch name that appears on the right-side of a
":" in a Pull specification. That's what the default master:origin
thing does along with committing to a local master. In my scheme above
I get something similar by putting a -origin on the
not-to-be-committed-to branches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060217/d686d59d/attachment.pgp


More information about the cairo mailing list