# Git branch

2 messages from 2010-07-13 to 2010-07-13. Participants: jhapk, Jonathan Nieder.
Thread: https://gitlist.dev/t/24387

## jhapk, 2010-07-13 22:50

Subject: Git branch
Message-ID: <1279061452603-5290193.post@n2.nabble.com>
URL: https://gitlist.dev/e/1279061452603-5290193.post%40n2.nabble.com

```

Hi,

I have a central bare repository B and two non-bare repositories A1 and A2.
Both A1 and A2 have B as the origin. The way I do it is that every time I
create a branch in A1, say branchA, I manually enter the following lines in
the .git/config files of A1 and A2
[branch "branchA"]
    remote = origin
    merge = refs/heads/branchA

Then I create a branch in the bare repository B called branchA. Once this is
done, all the push and pull works smoothly between the two repositories. 

Just wondering, is there a better way to do this? :)
-- 
View this message in context: http://git.661346.n2.nabble.com/Git-branch-tp5290193p5290193.html
Sent from the git mailing list archive at Nabble.com.

```

## Jonathan Nieder, 2010-07-13 23:04

Subject: Re: Git branch
Message-ID: <20100713230418.GA1818@burratino>
URL: https://gitlist.dev/e/20100713230418.GA1818%40burratino
In-Reply-To: <1279061452603-5290193.post@n2.nabble.com>

```
Hi,

jhapk wrote:

> I manually enter the following lines in
> the .git/config files of A1 and A2
> [branch "branchA"]
>     remote = origin
>     merge = refs/heads/branchA
> 
> Then I create a branch in the bare repository B called branchA. Once this is
> done, all the push and pull works smoothly between the two repositories. 
> 
> Just wondering, is there a better way to do this? :)

Maybe something like the following would work.

>From A1:

  git checkout -b branchA
  ... hack hack hack ...
  git push --set-upstream origin branchA
  ssh A2

>From A2:

  git checkout -t origin/branchA

```
