将代码标记为“准备生产” [英] flagging code as "ready for production"

查看:83
本文介绍了将代码标记为“准备生产”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我想知道是否有办法可以将我们的代码(文件或代码段)标记为准备推送到我们的测试环境或准备被推到我们的生产环境。我问,因为我们有一个事件,我的所有代码都已准备好被推送到生产中,但是我已经从我们的存储库更新了,其中包含其他人的代码,这些代码还没有准备好投入生产。但无论如何他们都被推了。 (幸运的是,它最终通过了测试。)如果我们有办法将该代码标记为"不是
准备好生产"。我不必担心检查它,排除它,注释掉代码,无论我怎么做以确保它不会被推向生产。

解决方案

< blockquote>

你好gib898,


感谢您在这里发帖。


>>> 如果我们有办法可以将我们的代码(文件或代码段)标记为已准备好推送到我们的测试环境或准备推送到我们的生产环境。


您是否使用Git作为代码版本控制?如果是,我们无法将我们的代码标记为已准备就绪,但我们可以将代码标记为
而不是已准备好推送
skip-worktree 。

 git update-index --skip-worktree< file> 

当你想要推送时那些代码文件,你可以使用no-skip-worktree:

 git update-index --no-skip-worktree< file> 

此外,对于代码部分,我们只能注释掉 代码部分。


如果我不理解你的问题,请免费让我,你可以更详细地描述你的问题。谢谢。


希望这可以帮到你。


Hello,

I'm wondering if there's a way that we can flag our code (files or sections of code) as ready to be pushed to our test environment or ready to be pushed to our production environment. I ask because we had an incident where all my code was ready to be pushed to production, but I had updated from our repository which happened to contain other people's code that was not ready to be pushed to production. But they got pushed anyway. (luckily it ended up passing testing.) If we had a way of flagging that code as "not ready for production" I wouldn't have to worry about check it, excluding it, commenting out code, whatever I would have to do to ensure it doesn't get pushed to production.

解决方案

Hi gib898,

Thanks for posting here.

>>>if there's a way that we can flag our code (files or sections of code) as ready to be pushed to our test environment or ready to be pushed to our production environment.

Do you use Git as code version control? If yes, we could not flag our code as ready to be pushed, but we could flag our code as not ready to be pushed by skip-worktree.

git update-index --skip-worktree <file>

When you want ready to push those code files, you can use no-skip-worktree :

git update-index --no-skip-worktree <file>

Besides, for the sections of code, we could only commenting out  sections of code.

if I not understand you question correctly, please let me for free and you can describe your question more detail. Thanks.

Hope this can help you.


这篇关于将代码标记为“准备生产”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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