git - 如何在不使用 Jenkins git 插件 checkout 文件的情况下获取分支上的最新提交

标签 git jenkins jenkins-plugins

我正尝试在 jenkins 中为我们的一个 repo 开发一个 CI groovy 管道。 repo 是巨大的(大约 18+ GB)。 checkout 大约需要 2/3 小时。我需要检索 repo 中分支的最新提交并触发一些测试(在已 checkout 的区域中)。

知道如何在不实际 check out 文件的情况下使用 Jenkins git 插件获取最新提交吗?

最佳答案

您可以使用 --depth 1 选项来克隆没有历史记录的 repo 的最后状态:

git clone --depth 1 <path to the repo>

关于git - 如何在不使用 Jenkins git 插件 checkout 文件的情况下获取分支上的最新提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58835584/

相关文章:

git - 如何防止 'git diff' 使用寻呼机?

c++ - 使用 iOS 或 c/c++ 访问 SVN 或远程 Git 存储库等

git - 有没有办法让 git 忽略整个分支?

git - 如何在 Jenkins 作业中克隆 github 组织的私有(private)存储库

docker - 如何在Windows docker上的jenkins中预安装插件?

jenkins - 无法将命名空间参数传递给 Jenkins 的 kubernetes-cli 插件

git - 如何找到 git 存储库中未签名的添加内容?

docker - Jenkins:在Windows上构建并推送Docker镜像

Jenkins:动态设置参数 defaultValue

java - 编译时如何让 IntelliJ 识别资源包?