Rebase problem. #22305
-
I have made two commits into wrong branch. What I’d like to do, but don’t want to break something is to remove these two commits and put them into correct branch. What I have done is:
I have SHA1 commit checksums. What I found is that I should start rebasing from the one commit before. But It is not explained why, so I am not entirely sure abut that. What should be the next step? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Interesting question. The git rebase command documentation has some good diagrams that should help make things more clear. If you’ve created a new branch, named
Then you can merge those new commits into the branch where you wanted them originally with the command:
The I hope that helps! |
Beta Was this translation helpful? Give feedback.
Interesting question.
The git rebase command documentation has some good diagrams that should help make things more clear. If you’ve created a new branch, named
newbranch
, that contains only the new commits that you want to move, you should be able to issue the command:Then you can merge those new commits into the branch where you wanted them originally with the command:
The
--ff
option is to ensure that you rebased things right and isn’t strictly necessary. You can then delete thenewbranch
branch and continue on as yo…