# pushing specific branches to a public mirror repos

5 messages from 2009-07-17 to 2009-07-17. Participants: Graeme Geldenhuys, Johannes Sixt, Bert Wesarg.
Thread: https://gitlist.dev/t/20141

## Graeme Geldenhuys, 2009-07-17 08:30

Subject: pushing specific branches to a public mirror repos
Message-ID: <h3pcrg$ekk$1@ger.gmane.org>
URL: https://gitlist.dev/e/h3pcrg%24ekk%241%40ger.gmane.org

```
Hi,

I cloned a SubVersion repository and am maintaining a Git mirror of it 
on GitHub. Here is an example of some of the SubVersion branches that 
got cloned.

refs/remotes/cleanroom
refs/remotes/fixes_2_0
refs/remotes/fixes_2_2
refs/remotes/fixes_2_2_0_dos
refs/remotes/florian
refs/remotes/fpc_2_3
refs/remotes/generics
refs/remotes/genfunc
refs/remotes/trunk
...

By default 'git svn' created a "master" branch which tracks 
"remotes/trunk". This is currently the only branch available on GitHub 
mirror repository and I push it as follows:

On our server which manages the subversion -> local git repos -> github 
sync process.

  $ cd /path/to/repository/
  $ git svn fetch
  $ git push github master

This works fine. Now I don't have any other local branches or any local 
modifications (I used to have, but reverted all of them) so now a 'git 
svn fetch' does clean fast-forward merges without problems.

I currently have the following git config setting for the remote github 
repository:

[remote "github"]
	url = git@github.com:graemeg/freepascal.git
	push = +refs/remotes/*:refs/heads/*

As far as I understand, if I do 'git push github', it is going to push 
all the SubVersion branches (as listed above) as heads to GitHub - but 
this is not what I want. Many of those branches in SubVersion are old, 
outdated or private development areas.

I only want to push the "trunk" and "fixes_2_2" SubVersion branches to 
GitHub as heads. How must I change by remote.github.push config setting, 
or must I do a manual push as I do with the local tracking "master" branch.

In summary:
  * Can I change remote.github.push so that if I run 'git push github'
    that it will ONLY push remotes/trunk and remotes/fixes_2_2 to
    GitHub mirror

  * or must I manually push those two to GitHub mirror as follows
     once off create a tracking branch:
       $ git branch --track fixes_2_2 remotes/fixes_2_2

     then hourly do the following:
       $ cd /path/to/repository/
       $ git svn fetch
       $ git push github master
       $ git push github fixes_2_2



Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

```

## Johannes Sixt, 2009-07-17 08:51

Subject: Re: pushing specific branches to a public mirror repos
Message-ID: <4A603B7A.6050208@viscovery.net>
URL: https://gitlist.dev/e/4A603B7A.6050208%40viscovery.net
In-Reply-To: <h3pcrg$ekk$1@ger.gmane.org>

```
Graeme Geldenhuys schrieb:
> I currently have the following git config setting for the remote github
> repository:
> 
> [remote "github"]
>     url = git@github.com:graemeg/freepascal.git
>     push = +refs/remotes/*:refs/heads/*
> 
> I only want to push the "trunk" and "fixes_2_2" SubVersion branches to
> GitHub as heads. How must I change by remote.github.push config setting,
> or must I do a manual push as I do with the local tracking "master" branch.

You can have more than one push line in the config:

    push = +refs/remotes/trunk:refs/heads/trunk
    push = +refs/remotes/fixes_2_2:refs/heads/fixes_2_2

-- Hannes

```

## Graeme Geldenhuys, 2009-07-17 09:11

Subject: Re: pushing specific branches to a public mirror repos
Message-ID: <h3pf9d$mo7$1@ger.gmane.org>
URL: https://gitlist.dev/e/h3pf9d%24mo7%241%40ger.gmane.org
In-Reply-To: <4A603B7A.6050208@viscovery.net>

```
Johannes Sixt wrote:
> 
> You can have more than one push line in the config:
> 
>     push = +refs/remotes/trunk:refs/heads/trunk
>     push = +refs/remotes/fixes_2_2:refs/heads/fixes_2_2


Excellent, thanks. I thought about that, but wasn't sure and did not 
want to try because I already screwed up the GitHub mirror once before.


 >     push = +refs/remotes/trunk:refs/heads/trunk

Must this stay as is, or must I push 'remotes/trunk' to 'heads/master'?


      push = +refs/remotes/trunk:refs/heads/trunk
vs
      push = +refs/remotes/trunk:refs/heads/master


 From my server...
$ git ls-remote github
6b9b6460aa79a4b86c6bb1535b78e4fc555f89d5	HEAD
6b9b6460aa79a4b86c6bb1535b78e4fc555f89d5	refs/heads/master


My local "master" branch is currently tracking the refs/remotes/trunk, 
but for some reason (which I don't understand), if I do a 'git svn 
fetch' by default master branch is not updated. I still have to run 'git 
svn rebase -l' to get master in sync. Is there something I can change in 
the config to automate that as well?



Regards,
   - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

```

## Bert Wesarg, 2009-07-17 09:47

Subject: Re: pushing specific branches to a public mirror repos
Message-ID: <36ca99e90907170247m7919980l38f8f379d2976c52@mail.gmail.com>
URL: https://gitlist.dev/e/36ca99e90907170247m7919980l38f8f379d2976c52%40mail.gmail.com
In-Reply-To: <h3pf9d$mo7$1@ger.gmane.org>

```
On Fri, Jul 17, 2009 at 11:11, Graeme Geldenhuys<graemeg@gmail.com> wrote:
> My local "master" branch is currently tracking the refs/remotes/trunk, but
> for some reason (which I don't understand), if I do a 'git svn fetch' by
> default master branch is not updated. I still have to run 'git svn rebase
> -l' to get master in sync. Is there something I can change in the config to
> automate that as well?
Try 'git svn rebase' instead.

Bert
>
>
>
> Regards,
>  - Graeme -

```

## Johannes Sixt, 2009-07-17 10:05

Subject: Re: pushing specific branches to a public mirror repos
Message-ID: <4A604CCD.5090108@viscovery.net>
URL: https://gitlist.dev/e/4A604CCD.5090108%40viscovery.net
In-Reply-To: <h3pf9d$mo7$1@ger.gmane.org>

```
Graeme Geldenhuys schrieb:
> Must this stay as is, or must I push 'remotes/trunk' to 'heads/master'?
> 
>      push = +refs/remotes/trunk:refs/heads/trunk
> vs
>      push = +refs/remotes/trunk:refs/heads/master

Both are OK. Pick the one that suits your needs.

-- Hannes

```
