Git重大承诺最佳实践 [英] Git big commit best practices

查看:78
本文介绍了Git重大承诺最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我喜欢做很多小的提交(如2个3文件),而不是大的,但这次在时间压力和变化涉及许多文件,我有很多文件unstaged。



我的问题是,什么是这种情况下的最佳做法?是否有任何工具可以让我在小提交中分割工作?



请注意,我确实知道手工完成小型提交,但是我害怕犯了一个错误,并且创建了一个让代码处于不一致状态的提交(比如不编译或工作不好)。

感谢!

解决方案

git add -i 提交块,然后 git stash 其余代码,检查一切是否正常, git commit git stash pop 和循环。


I'm using git and been working heavily on my local repository the last week.

I like to make many small commits (like 2 o 3 files) instead of big ones, but this time between time pressure and that the change involved many files, I've got a whole lot of files unstaged.

My question is, what is the best practice in this scenario? Is there any tool that lets me divide the work in small commits?

Note that I do know how to stage files one at a time and make the small commits by hand, but I'm afraid to make a mistake and create a commit that leaves the code in an inconsistent state (like not compiling or working badly).

Thanks!

解决方案

git add -i should help you divide commits to chunks, then git stash rest of code, check if everything works, git commit, git stash pop and loop.

这篇关于Git重大承诺最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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