Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I merge back into remote branch

Tags:

git

github

I have these 2 branches on my remote GitHub repository:

  • development
  • master

How do I merge development into master on the remote repository? I've tried

git merge development

and

git merge origin

but it says the repo is up to date so I'm doing it wrong because github says development is 12 commits ahead of master.

Update

Thanks for the follow ups - here's some more info, I did a push to the remote repository with

git push origin 

and my changes have been committed. If I do a clone in another folder I see all the changes there if I checkout the development branch.

git branch -av 
development      8265e30 - etc
hotfix-t4        8342e44 - etc 
*master          0041bod - Initial Commit
  remotes/origin/HEAD  -> origin/master
  remotes/origin/development 8265e30 - etc
  remotes/origin/experimental 22cd3ef test1
  remotes/origin/hotfix-t4 8342e44 test
  remotes/origin/master 0041bod Initial commit
like image 503
MikeW Avatar asked May 06 '12 09:05

MikeW


1 Answers

The behaviour of git push or git push origin (i.e. when you don't also specify a refspec as the last parameter) is rather surprising - by default it pushes each branch to one of the same name so long as a branch with that name exists both locally and remotely. (This default can be changed with the push.default config option.)

So, to be sure that you have correctly pushed a particular branch to the same name in the remote origin, it's a good idea to always use this form:

git push origin <branch-name>

... which is equivalent to git push origin <branch-name>:<branch-name>.

So, in full, to make sure that you have merged development to master locally, and then pushed master to GitHub, do exactly the following:

git checkout master
git merge development
git push origin master
like image 143
Mark Longair Avatar answered Nov 13 '22 13:11

Mark Longair