调试 Heroku 应用程序时如何避免大量提交 [英] How to avoid tons of commits when debugging Heroku app

查看:19
本文介绍了调试 Heroku 应用程序时如何避免大量提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试解决 Heroku 上应用程序的错误时,我通常会收到一堆与错误修复过程相关的 Git 提交,因为我需要提交更新才能推送到 Heroku.在推送到项目的主要共享存储库之前,是否有任何巧妙的方法来清理这些提交?

While trying to sort out bugs with apps on Heroku, I usually end up with a bunch of Git commits related to the bug fixing process, as I need to commit the updates in order to push to Heroku. Are there any clever ways of cleaning up those commits prior to pushing to the main shared repo for the project?

推荐答案

在开始调试时创建一个新分支(git checkout -b debugging 或类似),然后在那里进行所有提交,通过 git push heroku debugging:master 将它们推送到 Heroku 而不是你的 master.

Create a new branch when you start debugging (git checkout -b debugging or similar), and then make all your commits on there, pushing them to Heroku instead of your master via git push heroku debugging:master.

然后,当您解决问题时,您可以将调试更改压缩到单个提交中,然后将它们合并回 master:

Then when you've fixed the problem, you can squash your debugging changes into a single commit and merge them back into master:

git checkout master
git merge debugging --squash
git branch -D debugging

还有很多其他方法可以做到这一点,这一切都归结为您认为最合乎逻辑的方法.

There are lots of other ways to go about doing this, it all comes down to which you find the most logical.

这篇关于调试 Heroku 应用程序时如何避免大量提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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