首页 > 解决方案 > how to re set up parent branch where we make new branch there

问题描述

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

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?

标签: git

解决方案


如果您有功能 1 目前在开发时重新基于顶部,您可以使用 (使用git merge-base)将其移动到 master 顶部

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

这将需要:

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

至:

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

推荐阅读