Home > Back-end >  How to rebase branch
How to rebase branch

Time:12-02

I have 2 branches: 4 and 5, which represent 4 and 5 versions of my application (5 is continuation of 4). By my fault I created new branch from branch 5 (instead of 4) and do one commit. How to change my branch in that way: ostensibly I created my branch from branch 4 and added one commit?

Now:

4 ->
 \
  5 ->
   \
   my branch with one commit ->

I want:

 my branch with one commit ->
 /
4 ->
 \
  5 ->

CodePudding user response:

Simply run

git rebase 5 my-branch --onto 4
  • Related