简体   繁体   English

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

[英]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.

相关问题 我如何使用ANT在git中获得当前已检出分支的最新提交ID,而又没有进行有效的git安装? - How can I get the latest commit ID of the currently checked out branch in git, using ANT, without having an active git installation? 获取另一个分支git上的最新提交(无需检出) - Get latest commits on another branch git (without checking it out) 签出之前的提交后如何返回到最新的提交? (当分支名称未知时。) - How to get back to the latest commit after checking out a previous commit? (When the branch name is unknown.) 如何在git分支上获取最新的结帐提交? - how to get the latest checkout commit on git branch? Jenkins + Maven发布插件:release:branch + Git-无法提交文件 - Jenkins + Maven release plugin: release:branch + Git - Unable to commit files 如何在 jenkins 多分支脚本管道中获取最新的 git 提交作者姓名或消息并在分支条件下使用 - How to get latest git commit author name or message in jenkins multibranch scripted pipeline and use under branch condition 如何在不检查的情况下拉出 git 分支? - How to pull a git branch without checking it out? 如何判断git子模块应该在哪个提交,标记和分支上运行而无需检出 - How do you tell which commit, tag, and branch a git submodule should be on without checking it out 使用JGit按分支或提交ID签出Git存储库 - Checking out a Git repository by branch or commit ID using JGit 签出之前的提交后如何返回到最新的提交? - How to get back to the latest commit after checking out a previous commit?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM