使用dvcs / git,单个提交首选多个小型主题提交? [英] With dvcs/git, is a single commit preferred over multiple, small, thematic commits?

查看:98
本文介绍了使用dvcs / git,单个提交首选多个小型主题提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能不是一个特定于git的问题,但它出现在git的上下文中。这个想法可能会更广泛地适用于其他vcs。



我正在开发一个小型项目,目前我是唯一的开发人员。我习惯了使用git,所以我想知道最佳实践。当我实现新的特性/功能时,我发现我一次处理多个文件,它们的示例和文档,这样我的git状态可能会报告15个已更改的文件。但是这些文件可能与项目的3个不同部分有关。

将它们分成3个独立的部分,将相关文件保存在一起,以便我可以稍后回去后更容易找到那些提交。或者用一条适当的信息一次提交所有信息一样容易?

解决方案

一个标准可以帮助您制作提交的正确金额是 git bisect git blame :在尝试 git bisect code>为了检测一个错误?

这就是描述了解Git Workflow 博客文章,当它描述检查点提交(捕获处于不稳定状态的代码的提交太少)或 no-ff 提交时(这代表在一个大型提交中绑定在一起的太多修改)。


This may not be a git specific question, but it comes up in the context of git. The idea may apply more broadly to other vcs's.

I am working on a small project in which I am currently the only developer. I'm getting used to using git, so I am wondering about best practices. As I implement new features/functions, I find that I work on multiple files, their examples, and documentation at once, such that my git status may report 15 files that have changed. But those files might relate to 3 different parts of the project.

Is it better to commit them in 3 separate parts, keeping the related files together, so that I could later go back and more easily find those commits. Or it is just as easy to commit them all at once with an appropriate message?

解决方案

One criteria that can help you make the right "amount" of commit is git bisect or git blame: would a large commit be a nuisance when trying to git bisect in order to detect a bug?

That is what describes the "Understanding the Git Workflow" blog post, when it describes "checkpoint commits" (too little commits capturing the code in a unstable state), or "no-ff commits" (which represents too many modification bundled together in one large commit).

这篇关于使用dvcs / git,单个提交首选多个小型主题提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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