将主分支合并到另一个分支,但不合并两个分支 [英] Merge commit from Master-branch to another branch, but not to merge two branches

查看:136
本文介绍了将主分支合并到另一个分支,但不合并两个分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 我决定开发新功能,并且创建了新分支'new_branch'

  • 我在'new_branch'中创建了一些提交,但是我还没有完成新功能
  • 我决定修正master分支中的一些错误,所以我切换到master分支,修复代码和提交。

  • 现在,我希望将Master分支中的所有修订(所有提交)修改为'new_branch' 。但我不想将两个分支合并成一个,因为我的新功能还没有完全开发出来,我该怎么做?

    将您的主分支合并到您的功能分支中。

      git merge master new_branch 
    new_branch
    ,并且您可以继续开发您的新功能 new_branch


    1. I have git repository with one master branch.
    2. I decided to develop new feature and I have created new branch 'new_branch'
    3. I have created some commits in 'new_branch", but I am not finished new feature yet
    4. I decided to fix some bug in master branch, so I switch to master branch, fix code and made commits.

    Now, I want to have all fixes (all commits) from Master branch into 'new_branch'. But I don't want merge two branches into one, because my new feature is not fully developed yet. How can I do it ?

    解决方案

    Merge your master branch into your feature branch.

    git merge master new_branch
    

    Now, the fixes in master are applied to new_branch, and you can continue developing your new feature on new_branch.

    这篇关于将主分支合并到另一个分支,但不合并两个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆