简体   繁体   English

Git 和并行分支

[英]Git and parallel branches

I am using git and I have a local develop branch, from which I created new branch called BranchA , where I will work on FeatA .我正在使用 git 并且我有一个本地开发分支,我从中创建了一个名为BranchA新分支,我将在那里处理FeatA I worked on this feature, and I needed some additional input, so I needed to postpone work until I receive information I required.我研究了这个功能,我需要一些额外的输入,所以我需要推迟工作,直到我收到我需要的信息。 So I committed to BranchA , and created new branch BranchB from Develop branch.所以我致力于BranchA ,并从Develop分支创建了新的分支BranchB This resulted in having two parallel branches created from Develop branch.这导致从 Develop 分支创建了两个并行分支。

Now I received additional information for FeatA , so I reverted to BranchA , and finished FeatA.现在我收到了FeatA附加信息,所以我回到了BranchA ,并完成了 FeatA。 At this point I merged Develop branch with BranchA, pushed it to origin/Develop, and now I wish to continue developing on BranchB.此时我将Develop分支与BranchA合并,推送到origin/Develop,现在我想继续在BranchB上开发。

Do I need to "rebase" BranchB, so that its now based on "new" Develop branch, the one that contains FeatA also?我是否需要“rebase” BranchB,以便它现在基于“新” Develop 分支,也包含 FeatA 的分支? If yes, how do I do it?如果是,我该怎么做?

Need to?需要? No. Why would you?不,你为什么要? If there are conflicts you can solve them when merging.如果存在冲突,您可以在合并时解决它们。 If you need the features of BranchA in BranchB, then you can do this by (squash-)merging or rebasing (or even cherry-picking).如果您需要 BranchB 中 BranchA 的功能,那么您可以通过(挤压)合并或变基(甚至樱桃采摘)来实现。

Have you pushed you BranchB to a remote?你有没有把你的 BranchB 推送到远程? If so, you should not rebase your branch, unless you know what you are doing.如果是这样,除非您知道自己在做什么,否则您不应该重新设置分支的基础。

You might want to get a better understanding of how git works.您可能想更好地了解 git 的工作原理。 I recommend the git book我推荐git书

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM