Rebase including reverted commit
I want to merge my feature branch onto the develop branch. However, one of the commits reverted a commit that I now want.
* develop - merge revert PR |\ | * Revert undesired merge |/ * Merge (undesired) |\ | * commit A |/ | ... (lots of commits) | | * feature - commit B | * commit A' |/ *
git rebase -i develop does not show commit A'. I've tried various options (-p, --keep-empty, -f) without success.
How can I end up with
* feature - commit B * commit A' / * develop - merge revert PR
without individually cherry-picking? (There are more than just two commits - this example is simplified.)
(Note: The most recent commits are at the top in the diagrams. Also note that A and A' have the same contents; that is, they apply the same changes.)作者: TrueWill 的来源 发布者: 2017 年 12 月 27 日
You need to help
rebase figure out its to-do list from a point in time where "commit A" hasn't been merged yet.
git rebase -i develop, try:
git rebase -i undesired~ --onto develop
undesired is either a branch at or the SHA of the reverted merge commit.
Another option would be:
git rebase -i HEAD~2 --onto develop
...meaning "rebase the last two commits onto