I have a feature branch and a master branch. My feature branch was checked out of the master branch but prior to some of the commits that are currently on the master branch.
I’d like to rebase my commits on top of the master branch, but I do not want the master’s history changed, I’d like the rebase to apply all the commits in one fell swoop and maintain the integrity of the repo’s history on any remote branches.
Is this possible with git rebase?
Doing this on master
git rebase feature-branch-name
replayed the masters history on my feature branch, which isn’t what I intended.
Yes this is possible, and you were very close on your attempt. You just need to reverse it.
From the feature branch, run this:
Note that you may be prompted to resolve merge issues during this process. Once that is done, you’ll see that the most recent commits from master will appear in your feature branch, prior to any of the commits you had performed in your feature branch. Then, from the master branch, you can run this:
That will result in the master branch having all of the commits from your feature branch. There are various options when merging. Please reference the git documentation if you don’t like what you get from the defaults.