In what branch should I be when doing a rebase?
I have a
master branch with some commits that the branch
development doesn’t have.
development branch has even more commits that
master doesn’t have.
I want to merge the state of
master, i.e. override whatever changes
master has that
I have been told that I should a rebase. When I read about rebase, I understand that the syntax is the following:
git rebase master
What I don’t understand though, is from what branch I should write the command (to accomplish the described scenario), in
master or in
2 Solutions collect form web for “In what branch should I be when doing a rebase?”
In this specific scenario, you would write the
rebase command from the
This is similar to how
git merge master would merge master onto your current branch.
Checkout development and rebase from there as so:
git checkout development git rebase master
The latter example,
git rebase master development is a shorter version of the commands above (as described in the documentation you had linked).
This will cause your development branch changes to seem as if they started from the latest commit on master (provided you don’t run into any conflicts, which you’ll have to resolve during a rebase if you come across them). If all goes well you will be able to then merge development into master which will act as a simple fast-forward merge.
See http://rypress.com/tutorials/git/rebasing.html for a good explanation.