[英]How to get latest commit on a branch without checking out files using Jenkins git plugin
I am trying to develop a CI groovy pipeline in jenkins for one of our repo.我正在尝试在 jenkins 中为我们的一个仓库开发 CI groovy 管道。 The repo is huge (around 18+ GB).仓库很大(大约 18+ GB)。 Checkout takes around 2/3 hours.结帐大约需要 2/3 小时。 I need to retrieve the latest commit on a branch in repo and trigger some tests (in already checked-out area).我需要在 repo 的一个分支上检索最新的提交并触发一些测试(在已经签出的区域)。
Any idea how can i use Jenkins git plugin to get latest commit without actually checking out files?知道如何在不实际签出文件的情况下使用 Jenkins git 插件来获取最新提交吗?
for get the latest changes you have two choice:要获得最新的更改,您有两种选择:
git fetch
it just get all changes but only downloads new data from a remote repository - and it doesn't integrate any of this new data into your working files.它只是获取所有更改,但只从远程存储库下载新数据 - 它不会将任何这些新数据集成到您的工作文件中。
git pull
it is used with a different goal in mind: to update your current HEAD branch with the latest changes from the remote server.使用它时要考虑不同的目标:使用远程服务器的最新更改更新当前的 HEAD 分支。 Hope it will useful for you希望它对你有用
You can use --depth 1
option to clone the last state of the repo without history:您可以使用--depth 1
选项克隆没有历史记录的 repo 的最后一个 state:
git clone --depth 1 <path to the repo>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.