我如何将分支合并到主分支中,但继续在分支上工作? [英] How can I merge a branch into master but continue working on the branch?

查看:116
本文介绍了我如何将分支合并到主分支中,但继续在分支上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个分支来尝试不同的方法并且它有效,所以我想将Farmcrops分支合并到Master中以保留这些更改,但继续Farmcrops分支以探索另一种可能性。这样,如果这个最新的变化不起作用,我可以恢复到主,这将包括第一轮的变化。

I created a branch to try a different approach and it worked, so I would like to merge the "Farmcrops" branch into "Master" to keep those changes but continue the "Farmcrops" branch to explore another possibility. That way, if this latest change doesn't work, I can revert back to "Master" which would now include the first round of changes.

我该怎么做?

推荐答案

以下是您正在查找的过程:

Here is the process you are looking for:


  1. git checkout master

  2. git merge Farmcrops

  3. git push origin master

  4. git branch -d农作物

  5. git checkout master

  6. git checkout -b Farmcrops

  7. 继续提交分支 Farmcrops ...

  1. git checkout master
  2. git merge Farmcrops
  3. git push origin master
  4. git branch -d Farmcrops
  5. git checkout master
  6. git checkout -b Farmcrops
  7. continue your commits on the branch Farmcrops...

分支只是指针,创建/删除分支非常简单,如果您的分支 Farmcrops 不在远程存储库上推送,它绝对没有依赖关系。您可以在合并后将其删除并从主服务器重新创建。

Branches are just pointers, it's very easy to create/delete a branch and if your branch Farmcrops isn't pushed on remote repository, there is absolutely no dependency with it. You can delete it after the merge and recreate it from the master.

希望这能帮助您。

这篇关于我如何将分支合并到主分支中,但继续在分支上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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