简体   繁体   English

Git从一个分支分支并随后合并

[英]Git Branching From A Branch And Subsequent Merging

Could someone please tell me if this is okay/safe/sane... 有人可以告诉我这是否正常/安全/健全...

I create a branch from master called BranchA. 我从母版创建了一个分支,称为BranchA。 I then create a branch from BranchA called BranchB. 然后,我从BranchA创建一个名为BranchB的分支。 BranchA is merged back into master. BranchA合并回主服务器。 If I delete BranchA can I merge BranchB back into master safely or should I keep BranchA around and merge back into it first and then merge BranchA into master? 如果删除了BranchA,我可以安全地将BranchB合并回master中吗?还是应该保留BranchA并先合并回它中,然后再将BranchA合并成master?

Since Branch B has come off Branch A, it still knows about it. 由于分支B已经离开分支A,所以它仍然知道。 ie The history of the commits and state of the master branch when it was created is still there. 即,提交历史和master分支在创建时的状态仍然存在。 Once you create Branch B it is independent of Branch A. 创建分支B后,它就独立于分支A。

For Example, you can rewrite the history of branch A with a rebase, and it will have no affect on Branch B. 例如,您可以使用变基重写分支A的历史记录,并且对分支B不会产生任何影响。

Branches are just pointers to the tip and you can safely delete them. 分支只是指向技巧的指针 ,您可以安全地删除它们。 The underlying commits tree still exists and is exactly the same whether you have a pretty associated with some node in it or not; 底层的提交树仍然存在,并且无论是否与某个节点相关联,它都完全相同。 for that reason, merges work exactly as same too regardless of whether some interim branch('s name) was deleted or not. 因此,无论是否删除了某个临时分支(名称),合并的工作方式也完全相同。

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

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