在Git中:为什么经常承诺好? [英] In Git: Why is it good to commit often?

查看:72
本文介绍了在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天全站免登陆