git jenkins 在结帐前擦除存储库并强制克隆 vs Clean

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42305565/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:48:49  来源:igfitidea点击:

jenkins Wipe out repository and force clone vs Clean before checkout

gitjenkins

提问by Siddardha

I am trying to understand the difference between the two options “Wipe out repository and force clone” and “Clean before checkout” for pulling a git repo. Looking at the help section for both options, both seem to have similar functionality and I can't make out the difference. Here's how they look:

我试图了解拉 git 存储库的两个选项“擦除存储库并强制克隆”和“结帐前清洁”之间的区别。查看两个选项的帮助部分,两者似乎具有相似的功能,我无法区分。以下是它们的外观:

Wipe out repository & force clone:

Delete the contents of the workspace before building, ensuring a fully fresh workspace.

Clean before checkout

Clean up the workspace before every checkout by deleting all untracked files and directories, including those which are specified in .gitignore. It also resets all tracked files to their versioned state. This ensures that the workspace is in the same state as if you cloned and checked out in a brand-new empty directory, and ensures that your build is not affected by the files generated by the previous build.

清除存储库并强制克隆:

在构建之前删除工作区的内容,确保一个完全新鲜的工作区。

结账前清洁

通过删除所有未跟踪的文件和目录,包括在 .gitignore 中指定的文件和目录,在每次签出之前清理工作区。它还会将所有跟踪的文件重置为其版本化状态。这确保工作区处于与您在全新的空目录中克隆和检出时相同的状态,并确保您的构建不受先前构建生成的文件的影响。

I couldn't find any comparison between the two options; neither in Jenkins/GitPlugin wiki, nor in stack overflow, and not even in google. We currently have both options, but we are planning to reduce build time by removing the “Wipe out repository and force clone” option. But I don't want to break any functionality while doing this. Please explain the difference if you're sure. Thanks in advance :)

我找不到这两个选项之间的任何比较;既不在 Jenkins/GitPlugin wiki 中,也不在堆栈溢出中,甚至不在 google 中。我们目前有两种选择,但我们计划通过删除“擦除存储库并强制克隆”选项来减少构建时间。但我不想在这样做时破坏任何功能。如果您确定,请解释差异。提前致谢 :)

回答by vins

Wipe out repository & force clonewill clean the entire project workspace and clone the project once again before building. It could be time consuming depends on the project size. If the project is 1GB, it downloads 1GB everytime you build it.

清除存储库和强制克隆将清理整个项目工作区并在构建之前再次克隆项目。可能会很耗时,具体取决于项目大小。如果项目为 1GB,则每次构建时它都会下载 1GB。

Clean before checkoutremoves the files created as part of build - say your test results etc - resets the files if they were updated & pulls the latest changes if they have been updated. This ensures that the workspace is in the same state as if you cloned and checked out in a brand-new empty directory. It downloads only the delta which could be few MBs. So it is less time consuming.

结帐前清理会删除作为构建的一部分创建的文件 - 比如说您的测试结果等 - 如果文件已更新,则重置文件,如果已更新,则提取最新的更改。这可确保工作区处于与您在全新的空目录中克隆并签出时相同的状态。它只下载可能是几 MB 的增量。所以耗时较少。

So you can go ahead use Clean before checkoutwithout affecting the build. Have been using this option for more than 4 years without any issues.

因此,您可以在结帐前继续使用Clean,而不会影响构建。使用此选项已超过 4 年,没有任何问题。