如何处理实验性未合并的git分支? [英] What to do with experimental non-merged git branches?

查看:118
本文介绍了如何处理实验性未合并的git分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现有的最佳做法是使用git分支来创建测试bug的解决方案,并且没有被合并,因为审查过程显示他们错了或者有更好的解决方案?



一个例子。项目fizzbuzz有一个报告空字段崩溃的bug报告。




  • 我创建了一个新分支 handle-empty然后将该分支提交给fizzbuzz项目管理器,并将其链接到bug中。
  • 报告。


    有人在我的修复程序中发现错误,写入另一个修补程序并且该修补程序被接受。 >现在,处理空字段我的代码中的代码是无用的:它不正确,不能再应用于代码中,但它已被引用错误报告。



    我应该怎么做?保持分支?我将很快结束与几十个被遗弃的分支,git无法将分支标记为废弃或关闭。删除分支?但是,那些查看bug报告的人会发现它并得到404。

    人们经常被建议不要重新布局他们的存储库,因为这会给其他开发者带来问题,尤其是下游开发者。功能或错误修复分支的建议是什么?



    更新:它看起来像github永远不会删除包含在pull请求中的提交。所以,如果你推动你的改变,把他们变成一个拉取请求,你可以稍后删除分支而不会丢失你的任何改变。好了,而github上仍在工作;)


    解决方案

    GIT中更新-REF参/阁楼/处理-empty-fields refs / heads / handle-empty-fields



    作为在标签中保留死分支的替代方案,您可以使用单独的refs命名空间。好处是标签列表保持不变。一个缺点是从瓷器转移到管道水平的git。

    What are the current best practices with git branches that have been created to test out a solution to a bug and have not been merged because the review process show that they are wrong or there are better solutions to the problem?

    An example. Project fizzbuzz has a bug report that reports a crash on empty fields.

    • I create a new branch handle-empty-fields and make two commit to that branch, "solving" the problem.
    • Then I submit that branch to the fizzbuzz project manager, linking it in the bug report.
    • Somebody finds an error in my fix, writes another patch and that patch get accepted.

    Now the code in the handle-empty-fields my code is useless: it is not correct and cannot be applied any longer to the code, but it has been referenced in that bug report.

    What should I do? Keep the branch? I will quickly end up with dozens of abandoned branch and git has no way to mark a branch as abandoned or closed. Remove the branch? But then people looking at that bug report will find it and get 404.

    People are often suggested not to rebase their repositories because that will cause problems to other devs, especially downstream devs. What are the suggestions for feature or bug-fix branches?

    Update: it looks like github never deletes the commits contained in pull requests. So, if you push your changes an turn them into a pull request, you can later delete the branch without losing any of your changes. Well, while github is still working ;).

    解决方案

    git update-ref refs/Attic/handle-empty-fields refs/heads/handle-empty-fields

    As an alternative to preserving dead branches in tags you could use a separate refs namespace. The upside is that the tag list stays uncluttered. A downside is moving from the porcelain to the plumbing level of git.

    这篇关于如何处理实验性未合并的git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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