All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Graeme Geldenhuys <graemeg@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Pushing to GitHub doesn't push all branches
Date: Mon, 13 Jul 2009 13:01:15 +0200	[thread overview]
Message-ID: <4A5B13FB.4040203@drmicha.warpmail.net> (raw)
In-Reply-To: <h3eqap$cov$1@ger.gmane.org>

Graeme Geldenhuys venit, vidit, dixit 13.07.2009 10:12:
> Michael J Gruber wrote:
>> git config remote.origin.push '+refs/remotes/*:refs/heads/*'
> 
> OK, I've done this, but I'm not 100% sure what this means. This is what 
> I think (from reading various git help and users guide). Any branches I 
> have which track remote references (from svn repository) will be pushed 
> to github as various head references (normal branches).  Is this correct?

Yes, any ref you have that matches the pattern refs/remotes/* (all your
remote branches) is pushed to a ref named refs/heads/* in the repo (i.e.
a branch). The + means that non-fast-forward pushes are OK.

> On our server, which contain the svn cloned repository and the one that 
> is only used for syncing svn -> our server -> github, I had to add a new 
> commit which represents the svn-ignore meta data to a .gitignore file. I 
> noticed I had to manually to a 'git checkout master' & 'git merge 
> remotes/trunk' to pull in new updates. I thin pushed that to github.

You didn't tell us *that* before... Exactly this is why I asked whether
you want to do own work on those branches or just push a git-svn mirror.

I'm not sure adding .gitignore in a commit is a good idea, if that is
the only change you will make to the original branches. It keeps you
from doing a simple fetch and forces you to set up merging.

Also, svn-metadata may change over time. Do you intend to keep
.gitignore up to date with those changes?

> So what is my twice hourly cron script supposed to look like? Is the 
> following still ok?
> 
> ========[ script executed by cron every 30 minutes ]============
> #!/bin/sh
> GIT="/usr/local/bin/git"
> 
> # FPC repository
> cd /mnt/samba/git/fpc.git/
> $GIT checkout master
> $GIT svn fetch
> $GIT gc --auto
> $GIT push github master
> ==============================
> 
> Or do I need to add a new line after '$GIT svn fetch' that does a merge.
> 
> ==============================
> $GIT svn fetch
> $GIT merge remotes/trunk
> ...
> push to github
> ==============================
> 
> 
> Also what do I do with the other branch I want to track. It's called 
> remotes/fixes_2_2.
> 
> I believe I need to first create a local branch.
> 
>    git branch --track fixes_2_2 remotes/fixes_2_2
> 
> What do I need to modify in my cron script to keep both the master & 
> fixes_2_2 branches in sync with SubVersion and push both to GitHub. I 
> want Github to show two branches: master & fixes_2_2

Well, the way you used push you completely ignored the suggested
refspec. You pushed master into a matching ref (master). master may have
happened to be trunk before you added .gitignore (git-svn does not
guarantee that).

So, there are two options:

- Push the git-svn converted branches as is, using the suggested refspec
(or having it in config and doing "git push github"). "git svn fetch"
will have fetched all svn refs you need.

- Set up local branches and do your merge thing. In this case you
probably also want to keep up with svn metadata changes (mind that
ignore properties may depend on the branch as well). Done right this is
nice, but of course it may be a bit more fragile.

In the first case you would need to distribute .gitignore in a different
way. You could set up a separate branch (say svnhelper) for that which
consists of .gitignore (and possibly other things) only. "git show
svnhelper:.gitignore > .git/info/excludes" will set up each user. You
can also use a tag for that (i.e. instead of a branch).

Cheers,
Michael

  reply	other threads:[~2009-07-13 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 13:24 Pushing to GitHub doesn't push all branches Graeme Geldenhuys
2009-07-10 14:45 ` Michael J Gruber
2009-07-10 14:58   ` Michael J Gruber
2009-07-10 15:07   ` Graeme Geldenhuys
2009-07-10 15:51     ` Michael J Gruber
2009-07-13  8:12       ` Graeme Geldenhuys
2009-07-13 11:01         ` Michael J Gruber [this message]
2009-07-13 13:41           ` Graeme Geldenhuys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A5B13FB.4040203@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=graemeg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.