多久提交一次对源代码管理的更改? [英] How often to commit changes to source control?

查看:25
本文介绍了多久提交一次对源代码管理的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该多久提交一次对源代码管理的更改?在每个小功能之后,还是只针对大功能?

How often should I commit changes to source control ? After every small feature, or only for large features ?

我正在处理一个项目,并且有一个长期功能要实施.目前,我在完成每一块工作后提交,即每个子功能实现和错误修复.我什至在发现错误后为某些功能添加了新的测试块后提交.

I'm working on a project and have a long-term feature to implement. Currently, I'm committing after every chunk of work, i.e. every sub-feature implemented and bug fixed. I even commit after I've added a new chunk of tests for some feature after discovering a bug.

但是,我担心这种模式.在富有成效的一天工作中,我可能会提交 10 次.鉴于我使用的是 Subversion,这些提交会影响整个存储库,所以我想知道制作这么多确实是一个好习惯吗?

However, I'm concerned about this pattern. In a productive day of work I might make 10 commits. Given that I'm using Subversion, these commits affect the whole repository, so I wonder if it indeed is a good practice to make so many ?

推荐答案

每当我完成对编译和运行代码的完整思考"时,我就会签入.这通常最终会在 15-60 分钟之间.有时它可能会更长,但如果我有很多代码更改,我不想在失败的情况下重写,我总是尝试检查.我通常还确保我的代码编译成功,并在我下班回家之前签到.

Anytime I complete a "full thought" of code that compiles and runs I check-in. This usually ends up being anywhere between 15-60 minutes. Sometimes it could be longer, but I always try to checkin if I have a lot of code changes that I wouldn't want to rewrite in case of failure. I also usually make sure my code compiles and I check-in at the end of the work day before I go home.

我不会担心进行太多"提交/签入.当您必须重写某些内容时真的很糟糕,而且能够以小增量回滚以防万一真是太好了.

I wouldn't worry about making "too many" commits/check-ins. It really sucks when you have to rewrite something, and it's nice to be able to rollback in small increments just in case.

这篇关于多久提交一次对源代码管理的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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