how to re set up parent branch where we make new branch there

Viewed 28

I have a branch called FEATURE-1 and I created this branch from staging then:

  • I push this FEATURE-1 and got conflict,
  • I rebased git rebase into development

After I already tested my FEATURE-1 and no issue so far then I could go to staging branch.

Unfortunately not all codes from branch development should into staging, but my branch FEATURE-1 already got rebased from development.

To be safe better I want to get the source branch from master instead.

Is that possible for my branch FEATURE-1 set up to branch master for the source origin?

1 Answers

If you have feature 1 currently rebased on top if develop, you can move it on top of master with (using git merge-base)

git rebase --onto master $(git merge-base develop feature1) feature1

That will take:

m--m--m--m--m (master)
    \
     d--d--d--d (develop)
               \
                f--f--f (feature1)

To:

              f'--f'--f' (feature1)
             /
m--m--m--m--m (master)
    \
     d--d--d--d (develop)
Related