Noitidart
Noitidart

Reputation: 37318

git rebase [branch] AT entry point

I have in my current local branch 10 commits:

I want to do git rebase other-branch but i dont want it to put it as the "oldest commit", meaning I dont want it to come in before "Commit 1".

I want to put it right before the latest commit, so after git rebase other-branch there will be

I thought this would be possible, because we can use git rebase -i to move around commit order.

Upvotes: 1

Views: 38

Answers (1)

Jonathan.Brink
Jonathan.Brink

Reputation: 25433

This will re-write the history of your branch, but you can accomplish this with:

git reset --hard COMMIT9SHA
git merge other-branch
git cherry-pick COMMIT10SHA

If you want to avoid a merge-commit, you could first switch to other-branch and rebase it off of COMMIT9SHA:

git checkout other-branch
git rebase COMMIT9SHA

Upvotes: 1

Related Questions