Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 将临时更改推送到heroku,然后将其删除(从git中)_Ruby On Rails_Git_Heroku - Fatal编程技术网

Ruby on rails 将临时更改推送到heroku,然后将其删除(从git中)

Ruby on rails 将临时更改推送到heroku,然后将其删除(从git中),ruby-on-rails,git,heroku,Ruby On Rails,Git,Heroku,有时候我会在Heroku上的rails应用程序中调试一些东西。例如,我可能会在视图中输出一些调试信息。目前,我将对代码进行更改,将其提交到git,然后将其推送到heroku。完成后,我将删除调试代码,提交,再次推送到heroku。问题是我的git历史被这些乱七八糟的东西弄得乱七八糟。由于我的临时代码被推送到heroku,我无法使用rebase更改git历史记录 有没有办法做到这一点并清理我的git历史记录 请记住,我的问题实际上是关于如何还原我所做的临时更改,以便它们不会出现在我的git历史记录

有时候我会在Heroku上的rails应用程序中调试一些东西。例如,我可能会在视图中输出一些调试信息。目前,我将对代码进行更改,将其提交到git,然后将其推送到heroku。完成后,我将删除调试代码,提交,再次推送到heroku。问题是我的git历史被这些乱七八糟的东西弄得乱七八糟。由于我的临时代码被推送到heroku,我无法使用
rebase
更改git历史记录

有没有办法做到这一点并清理我的git历史记录


请记住,我的问题实际上是关于如何还原我所做的临时更改,以便它们不会出现在我的git历史记录中。

最简单的方法是使用
git branch debug
分支调试代码,然后
git checkout debug
。从那里,您可以使用命令
git push Heroku debug:master
将其推送到Heroku。当需要将其从代码库中取出时,您可以
git checkout master
git push heroku master--force
,覆盖heroku上的调试代码,并
git branch-D debug
删除调试分支

这太棒了,没想到我可以用力推