我应该使用Git Branch获取额外的日志记录代码,以获取一个令人讨厌的仅限生产的错误吗?

时间:2012-07-16 21:58:27

标签: git git-branch error-logging

我有一个实时网站,其中只有PROD才会显示错误。我在想,而不是在我的prod分支上实现一些日志记录,我会创建一个特殊的短期日志记录分支,然后在我的登台服务器中首先测试它进入PROD。然后,一旦我解决了问题,我就可以切换回主干分支。

我意识到PROD中的测试是错误的,但我们无法在登台服务器中重现此错误。我是否错过了一种方法,或者您是否可以评论将树枝(与树干相差不大)拉到生产中的危险?

1 个答案:

答案 0 :(得分:1)

最简单的方法是将PROD分支到一个短期测试分支。你应该在你看到问题的提交/标签上进行分支。

使用此分支进行任何更改并解决问题。在Staging Server上验证FIX后,将更改合并回PROD分支。

git checkout PROD
git branch my_short_lived_branch
<DEPLOY short_lived_branch on Staging Server to confirm issue is reproducible>
<DEBUG and FIX the issue>
<DEPLOY and confirm the FIX>
git checkout PROD
git merge --no-ff my_short_lived_branch
<DEPLOY on Staging server and confirm the issue is fixed>
<IF the issue is fixed, deploy the changes to your production server>