Skip to contentSkip to conversation

Approach for collaborative branches

DISCUSSION Gary Pickrell 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 7 lines · Gary Pickrell

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.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#2 lore raw

Thank you Matthieu,

It did exactly what I wanted and I wouldn't have figured it out by myself.

-Gary

Quoted 34 lines · Matthieu Moy
Quoted 8 lines · Gary Pickrell

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.