在 Git 中:为什么经常提交是好的? [英] In Git: Why is it good to commit often?

查看:44
本文介绍了在 Git 中:为什么经常提交是好的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以总的来说,我对 Git 和 DVCS 还是很陌生,而且我到处都在阅读,至少在私人分支上,始终提交总是好的".问题是:为什么?我正在使用 SourceTree(具有图形界面的 Git 客户端),我发现在一切正常并完成后(暂存,然后)提交我的代码要容易得多,因为在提交之前我仍然可以在 SourceTree 中看到我的差异.

那么频繁提交的原因是什么?我应该多久做一次?

解决方案

提交背后的想法经常是为自己创建一个实时的变化提要.我认为这也是一种保护措施,以防您对代码进行小的更改,并且出现问题并且您丢失了正在处理的版本.这样它就减少了人类记忆的必要性,而是依赖于(冗余)计算机存储.

So I'm quite new to Git and DVCS in general, and I've been reading everywhere that, at least on private branches, "it is always good to commit all the time". The question is: why? I am using SourceTree (Git client with graphical interface) and I find it much easier to (stage and then) commit my code once everything is working and I'm done, since I can still see my diffs in SourceTree before committing.

So what's the reason for committing more often? And how often should I do it?

解决方案

The idea behind committing often is to sort of create a live feed for yourself of changes. I think it's also a safeguard in case you make a small change in your code, and something goes wrong and you lose the version you were working on. That way it reduces the necessity for human memory, and relies on (redundant) computer storage instead.

这篇关于在 Git 中:为什么经常提交是好的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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