提交更改存储库的好条件是什么? [英] What are the good criteria for committing changes to repository?

查看:112
本文介绍了提交更改存储库的好条件是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用git来管理多个项目,但最近有一个问题困扰着我:对主分支和次分支进行修改的好处是什么?它应该是编译时提交,在工作时提交还是其他内容?感谢。

I'm currently using git for managing several projects, however, one question has been bugging me recently: what is the good tone for committing modifications to the master branch and to secondary branches? Should it be 'commit when it compiles', 'commit when it works', or something else? Thanks.

推荐答案

这真的取决于,这是您的个人回购还是许多开发人员共享的回购?你有多远?

It really depends, is this your personal repo or is it a repo that is shared by many developers? How far into the project are you?

个人而言,当我完成一个方面并编译所有内容时,我会将其提交给我的Subversion存储库。它不必是完整的,只是没有破碎。

Personally I commit to my subversion repositories when I am done with one aspect and everything compiles. It does not have to be complete, just not broken. I prefer to not leave things broken in the first place.

一半的书面代码可以办理登记手续,但只能在我的个人分支机构中进行,一般会记录我正在做的事情当时还有什么需要完成。由于我使用的是Subversion,这是我个人的回购,我主要用它来离开我的桌面,然后从我的笔记本电脑上离开的地方重新拾起。

Half written code can get checked in, but only in my personal branches, generally with notes about what I was doing at the time and what still needs to get done. Since I use Subversion and this is my personal repo I use this mainly to be able to leave my desktop and pick back up where I left off on my laptop.

每次提交一个bug /问题/功能很好,但可能不适合您的开发风格。如果这是一个更完整的项目,它可能会奏效,因为提交意味着您将项目从某个列表中移出,这意味着另外一个项目已完成。

Generally the one bug/issue/feature per commit is nice, but may not suit your development style. If this is a more complete project it may work out since commits mean that you are crossing items off a list somewhere and it means one more item that is now completed.

其他需要考虑的事情,对于需要检查的更改有什么意义?例如,我昨晚在代码中检查了一个内部API,这意味着我必须记录提交消息中的更改以及文档。同时我也修改了一些评论来修正错字。这会在提交消息上得到一个小小的注释,但是我认为这不是一个足够大的问题来自行提交。

Other things to consider, what is significant about the changes that it warrants checking in? For example, I checked in code last night that significantly changed an internal API, this meant I had to document the changes in the commit message as well as the documentation. At the same time I also changed a few comments to fix typo's. That gets a small sub-note on the commit message, but is not something I consider a big enough issue to get committed on its own.

这篇关于提交更改存储库的好条件是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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