threads / discuss / 21879

Approach for collaborative branches

Subject: Approach for collaborative branches

## tl;dr

3 messages between Dec 6, 2009 and Dec 6, 2009.

replies: 2people: 2as markdown or json

Gary Pickrell· Dec 6, 2009, 16:57 UTC · lore
My apologies if this is the wrong place to ask my question.

I've setup a git remote repository and placed the source for a windows program there. I'm working on getting it to compile on Ubuntu. The compilers are different so the code needs to be tweeked to make sure it compiles fine in Ubuntu without breaking anything in Windows. Great! This is a situation that calls for git branches, I thought. Did the following:

1) Clone the repository on Ubuntu
2) Made an Ubuntu branch
3) Made my changes to the code.  Added files...ect
4) Used git push origin Ubuntu to push the changes to the repository

I'm unable to see my Ubuntu changes on my windows machine. How should I proceed?

Thanks in advance.
    -Gary
Matthieu Moy· Dec 6, 2009, 17:15 UTC · re: Gary Pickrell · lore

Re: Approach for collaborative branches

Gary Pickrell <gary@pickrell.com> writes:
Show 7 quoted lines
> 1) Clone the repository on Ubuntu
> 2) Made an Ubuntu branch
> 3) Made my changes to the code.  Added files...ect
> 4) Used git push origin Ubuntu to push the changes to the repository
>
> I'm unable to see my Ubuntu changes on my windows machine.  How should
> I proceed?
On the windows machine, you should do first
  git fetch

this will tell you about the new branch if you didn't fetch it already. If it's called Ubuntu remotely, it's probably called origin/Ubuntu on your local repository after doing a fetch. Therefore, you can now do

  git merge origin/Ubuntu

Now, you probably also want your local branch to be named the same way on both machines. One way to do that is to create a branch "foo" on the repository, then on both sides, fetch it and do

  git checkout --track origin/foo

this will create a local branch foo, and tell git that further "pull" should take their changes from origin/foo.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Gary Pickrell· Dec 6, 2009, 18:56 UTC · re: Matthieu Moy · lore

Re: Approach for collaborative branches

Thank you Matthieu,
It did exactly what I wanted and I wouldn't have figured it out by myself.
    -Gary
Matthieu Moy wrote:
Show 34 quoted lines
> Gary Pickrell <gary@pickrell.com> writes:
>
>   
>> 1) Clone the repository on Ubuntu
>> 2) Made an Ubuntu branch
>> 3) Made my changes to the code.  Added files...ect
>> 4) Used git push origin Ubuntu to push the changes to the repository
>>
>> I'm unable to see my Ubuntu changes on my windows machine.  How should
>> I proceed?
>>     
>
> On the windows machine, you should do first
>
>   git fetch
>
> this will tell you about the new branch if you didn't fetch it
> already. If it's called Ubuntu remotely, it's probably called
> origin/Ubuntu on your local repository after doing a fetch. Therefore,
> you can now do
>
>   git merge origin/Ubuntu
>
>
> Now, you probably also want your local branch to be named the same way
> on both machines. One way to do that is to create a branch "foo" on
> the repository, then on both sides, fetch it and do
>
>   git checkout --track origin/foo
>
> this will create a local branch foo, and tell git that further "pull"
> should take their changes from origin/foo.
>
>   

← back to recent threads