git practices

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 13 16:45:22 PDT 2009


On Tue, Oct 13, 2009 at 04:01:19PM -0700, Jeremy Huddleston wrote:
> On Oct 13, 2009, at 14:48, Peter Hutterer wrote:
>
>> On Tue, Oct 13, 2009 at 12:08:53PM -0700, Jeremy Huddleston wrote:
>>> I'm still holding off branching from master or creating my own  
>>> xserver
>>> git because I want to read your promised "best practices", so I do it
>>> correctly.  Have you gotten around to starting that up?
>>
>>
>> http://www.x.org/wiki/XServer
>> is what we have so far. Let me know what's missing and I'll add it.


> Ok, thanks.  Some questions/confusion from someone who isn't a git- 
> expert:

Thanks, I tried to merge your comments into the above page, please have a
look again. See the diff here http://www.x.org/wiki/XServer?action=diff

> ---
>
> In "Scooping", Shouldn't we be using 'git fetch origin; git rebase  
> origin/master' rather than 'git pull origin'?
>
> Is 'git pull --rebase' the same thing as 'git fetch; git rebase  
> _______'?

yes, 'git pull --rebase origin' is the same as 'git fetch origin; git rebase
origin/master'.
you can set up hooks for each repo to tell it what it means when you don't
specify the remote but I've gotten used to always supplying the remote.
IIRC you can also set git up that git pull --rebase rebases a diffent branch
but I don't know how to do that - never needed to.

> I guess I'm just confused about pull.

please look, I hope I explained now when to rebase and when to pull but I
didn't add a full documentation on pull/rebase - this isn't the right page
for it.

> ---
>
> How can I get email sent for pushes to my personal git?  (eg: I'd like  
> to have mail sent to xquartz-changes at lists.macosforge.org)

in your fdo repository, edit .git/hooks/update.
(look at /srv/anongit.freedesktop.org/git/xorg/xserver.git/hooks/update
on annarchy for the xorg-commits email generation)

> ---
>
> When I'm on my local branch, how do I make it so master pushes to my  
> tree on anarchy?  Assume I've done:
>
> git clone ssh://git.freedesktop.org/git/xorg/xserver
> cd xserver
> git remote jeremyhu ssh://git.freedesktop.org/~jeremyhu/xserver.git
            ^^ git remote add
> git push jeremyhu master
> # edit some files
> git commit -a
> git push # will this send my local master to origin/master or jeremyhu/ 
> master?  How can I make it use jeremyhu/master if it's still origin/ 
> master?

push without a remote always pushes to origin (git.freedesktop.org)
IIRC in older versions of git that even pushed all local branches to the
remote, hence why I started always using explicit remotes and branches.
so in the future you should always use git push <remote> <branch>, pushes
your local branch to remote/branch. 

the safest way is to clone origin anongit, that way you can't accidentally
push into it (though that stops you from pushing into 1.7-nominations as
well of course).

so, back to start - does the wiki page answer the questions now?

Cheers,
  Peter


More information about the xorg-devel mailing list