I branched master
to make a feature
. Then I branched that feature
to make a feature2
. Now I want to get all the changes into master
. How do I do that? I was thinking I'd do this:
git rebase master feature #to make sure history is linear
git rebase feature feature2 #to make sure history is linear
git checkout feature
git merge feature2 --ff-only
git checkout master
git merge feature --ff-only
Would this do the trick? I want my history to be linear because I'm using git-svn and I heard non-linear history messes it up.
That will get you where you want to go. You can omit the merging of feature2 -> feature and merge feature2 directly into master, if you want a slightly simpler set of commands.
git rebase feature feature2 # Ensure that all feature changes are
# included in feature2
git rebase master feature2 # Create a linear history
git checkout master
git merge feature2 # Merge feature2, which contains feature,
# into master