Reputation: 2105
I understand that if I have a branch ready to merge with remote master, I need to do:
git checkout 'my branch'
git rebase master (rebase because I want simple history + my changes are minuscule enough to do that). But it will be rebase with my local master, not with origin master, correct?
git checkout master
git merge 'my branch' - this will do fast-forward merge and completes the process.
But how to do the same merge with remote master? I don't see any explicit explanation in the Internet. I cannot just checkout on origin master on the 3d step. What am I missing?
Upvotes: 1
Views: 162
Reputation: 60497
The remote master is whatever the remote repo identifies as master
. Whenever you fetch from the origin
remote, git tags that remote's master
commit as your origin/master
(in your remotes
refs).
The way to update a remote repo's refs is to push to it (which also sends any commits or whatever else is needed). So:
git checkout master # or however you want to get `master` current with origin
git pull # ...
git checkout mybranch
git rebase master
git checkout -B master # you know it's going to --ff, so just move the ref
# or, you could `git checkout master; git merge mybranch`
git push origin master # push the new commits to the remote's `master`
Upvotes: 3
Reputation: 8715
You can simply rebase on top of the origin master like this
git rebase origin/master
Also you can skip 3. and 4. simple pushing your rebased branch to the origin/master
git push origin my_branch:master
Upvotes: 3