[英]How to create branch for feature when i need some code of other branch (not merged in develop branch)
There is a big challenge in doing my tasks, and that is doing interdependent tasks Which I said in this picture.做我的任务有一个很大的挑战,那就是做我在这张照片中所说的相互依赖的任务。 Suppose we have two tasks, A and B, to perform subtasks A1, A2, and B1, B2, given that task B depends on A.假设我们有两个任务 A 和 B 来执行子任务 A1、A2 和 B1、B2,假设任务 B 依赖于 A。
To perform task B ideally, you should do tasks like this image.要理想地执行任务 B,您应该执行类似此图像的任务。
But this does not happen in many cases, for example, when doing A2 work from the server and to avoid wasting time, we decided to work on task B at the same time.但这在很多情况下不会发生,例如,在服务器上做 A2 工作时,为了避免浪费时间,我们决定同时处理任务 B。 In this case, the first solution that I do not think is true is to make Branch B from A, as in the image below, which is not very correct, because Branch B implicitly includes A1, and if there is a bug, it develop transfers.在这种情况下,我认为不正确的第一个解决方案是从 A 制作分支 B,如下图所示,这不是很正确,因为分支 B 隐式包含 A1,如果有错误,它会开发转移。
Branch B implicitly includes A1, and if there is a bug, it develop transfers. B分支隐含A1,如果有bug,开发转移。
That seems inevitable if A and B are so interlinked.如果 A 和 B 如此相互关联,这似乎是不可避免的。
If there is a bug in A, you will need to merge or cherry-pick it to B (created from A).如果 A 中存在错误,您需要将其合并或挑选到 B(从 A 创建)。
But for highly-coupled tasks like A and B... I would create only one branch ABui, and one ABapp但是对于像 A 和 B 这样的高度耦合的任务......我只会创建一个分支 ABui 和一个 ABapp
Branching from feature branches is a good indicator of messy process .从特征分支分支是混乱过程的一个很好的指标。 Sometimes it's inevitable, but each time you have to think about other solutions:有时这是不可避免的,但每次您都必须考虑其他解决方案:
You tagged your question with GitFlow - it usually implies a lot of unnecessary branches.你用 GitFlow 标记了你的问题——它通常意味着很多不必要的分支。 Just so that you're aware - GitFlow is an outdated branching strategy .只是让您知道-GitFlow 是一种过时的分支策略。 It's only applicable when you maintain multiple versions of the product at the same time.仅当您同时维护产品的多个版本时才适用。
to avoid wasting time, we decided to work on task B at the same time为了避免浪费时间,我们决定同时处理任务 B
While you think you don't waste time by starting to work on B - you may end up wasting more time because of the parallel work.虽然您认为开始在 B 上工作不会浪费时间,但您最终可能会因为并行工作而浪费更多时间。 Modern dev processes (Just-in-time, Theory of Constraints, Continuous Delivery) teach us to have small amount of unfinished work (aka Inventory Costs) - the smaller the better.现代开发流程(即时、约束理论、持续交付)告诉我们有少量未完成的工作(也称为库存成本)——越小越好。 By branching too much and having a lot of unreleased code you increase the amount of unfinished work which increases the costs of development.通过分支过多并拥有大量未发布的代码,您会增加未完成工作的数量,从而增加开发成本。
given that task B depends on A.假设任务 B 依赖于 A。
This implies that B will have all the bugs you write in task A. There's no way to avoid that if this dependency holds.这意味着 B 将拥有您在任务 A 中编写的所有错误。如果这种依赖关系成立,则无法避免这种情况。
As those bugs are fixed on A1, you can merge branch A1 into branch B.由于这些错误已在 A1 上修复,您可以将分支 A1 合并到分支 B。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.