git rebase master then push origin branch results in non-fast-forward error

后端 未结 2 753
温柔的废话
温柔的废话 2021-01-02 15:20

I am trying on working on my featureA branch while keeping it up-to-date with the master branch.

Here is the scenario

git clone ssh://xxx/repo

git c         


        
2条回答
  •  情歌与酒
    2021-01-02 15:40

    A short answer to your question: you can do the reverse by rebasing master against featureA (but don't push yet), and reset featureA to that point.

    This is actually cherry picking the commits from master onto featureA, the downside is that you will end up with duplicate commits on two branches. It will solve your immediate problem (if that's your intention) but in the long run you should not be rebasing commits that have already been pushed to a remote branch. The best solution in your scenario is actually to merge.

提交回复
热议问题