我如何将分支合并到主分支中,但继续在分支上工作? [英] How can I merge a branch into master but continue working on the branch?
问题描述
我创建了一个分支来尝试不同的方法并且它有效,所以我想将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:
-
git checkout master
-
git merge Farmcrops
-
git push origin master
-
git branch -d农作物
-
git checkout master $ c>
-
git checkout -b Farmcrops
- 继续提交分支
Farmcrops
...
git checkout master
git merge Farmcrops
git push origin master
git branch -d Farmcrops
git checkout master
git checkout -b Farmcrops
- 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屋!