DVCS-提交更改的频率和时间 [英] DVCS - How often and when to commit changes

查看:88
本文介绍了DVCS-提交更改的频率和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

StackOverflow上还有一个线程, wih将更改提交给源代码管理的频率。我想把它放在使用git或mercurial之类的DVCS的背景下。


  1. 您多久提交一次?


  2. 您仅在
    正确构建时才提交更改吗?



  3. 如何多久,何时推送更改(或提交拉取请求或类似请求)?


  4. 您如何批准开发复杂的功能/进行复杂的重构需要触摸很多地方?不能建立私人提交吗?完成后,您是否还将它们也推送到主存储库中?还是在推送之前将所有更改捆绑到一个变更集中?



解决方案

这取决于您正在处理的分支(开发线)的性质。



主要那些DVCS(git或mercurial)的优点是您可以轻松进行:




  • 分支

  • 合并



所以:


1 /

2 /您仅在更改正确构建后才提交更改吗?




仅在单元测试通过的情况下才提交的做法是一个好习惯,但只应适用于官方(如可以发布或推送分支:在您的私人分支中,如果需要,可以合并gazillon时间。

唯一的事情是:做一些合并--interactiv e在您可以通过一些测试的主开发分支上重播它们之前,在私有分支上重新组织许多提交。


3 /您多久和一次推送更改(或提交拉取请求或类似请求)?


出版是另一回事,应该以清晰的历史记录(连贯的合并,代表可以编译并通过一些测试的内容)进行。 )。

您发布的分支机构应该是永远不会重写历史的分支机构,始终保持更新。

出版的进度取决于远程分支机构的性质和人口拉那个分支。例如,如果是另一个团队,则可以经常推动。如果是针对整个系统的集成测试团队,则您会减少很多工作。


4 /您如何开发一个复杂的功能/进行复杂的重构需要涉及许多地方?不能建立私人提交吗?完成后,您是否还要将它们也推送到主存储库中?还是在推送之前将所有更改捆绑到一个变更集中?


请参见1.和2 .:首先在您自己的私有分支中打补丁,然后在正式的(已发布)补丁分支上重新组织提交。如果补丁涉及多个不同的活动(或错误修复),则一次提交并不总是最佳选择。


There is another thread here on StackOverflow, dealing wih how often to commit changes to source control. I want to put that in the context of using a DVCS like git or mercurial.

  1. How often and when do you commit?

  2. Do you only commit changes when they build correctly?

  3. How often and when do you push your changes (or file a pull request or similar)?

  4. How do you approac developing a complex feature / doing a complex refactoring requiring many places to be touched? Are "private commits" that won't build ok? When finished, do you push them also to the master repository or do you bundle all your changes into a single changeset before pushing?

解决方案

It depends on the nature of the branch ("line of development") you are working on.

The main advantage with those DVCS (git or mercurial) is the ease you can:

  • branch
  • merge

So:

1/ How often and when do you commit?
2/ Do you only commit changes when they build correctly?

As many time as necessary on a private branch (for instance, if it compiles).
The practice to only commit if unit tests pass is a good one, but should only apply to an "official" (as in "could be published or 'pushed'") branch: in your private branch, you merge a gazillon times if you need to.
The only thing is: do some merge --interactive to reorganize your many commits on your private branch, before replaying them on your main development branch, where you can pass some tests.

3/ How often and when do you push your changes (or file a pull request or similar)?

Publication is another matter and should be done with a "clear" history (coherent merges, representing a content which compile and pass some tests).
The branch you publish should be one where the history is never rewritten, always updated.
The pace of the publications depends on the nature of the remote branch and of the population pulling that branch. For instance, if it is for another team, you could push quite often. If it is for a system-wide integration testing team, you will push a lot less often.

4/ How do you approach developing a complex feature / doing a complex refactoring requiring many places to be touched? Are "private commits" that won't build ok? When finished, do you push them also to the master repository or do you bundle all your changes into a single changeset before pushing?

See 1. and 2.: patch first in your own private branch, then reorganize your commits on an official (published) patch branch. One single commit is not always the best option if the patch involves several different "activities" (or bug fix).

这篇关于DVCS-提交更改的频率和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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