如何从主仓库中检出最近5天的git branch jenkins gui编辑

问题描述

团队,

我试图通过手动编辑jenkins gui configuration搜索用户检查过的字符串。每当我们保存此gui配置时,就直接向gerrit提交master。现在,我想搜索所有最近三天的提交,看看是谁做了。

所以当我在下面进行操作时,一整天都可能需要30天的提交时间。

git clone ssh://git.team.com:29111/jenkins_configuration

我可以说这里有一个参数

--since 3d

仅下载那些提交并节省一些时间?

输出

cloning into 'jenkins_configuration'...
remote: Counting objects: 204746,

预期产量

cloning into 'jenkins_configuration' last 3 day commits...
remote: Counting objects: xxx,

解决方法

使用Git命令可以执行:

PS C:\> $PSVersionTable.PSVersion.ToString()
5.1.19041.1

ASCII:  Uses the encoding for the ASCII (7-bit) character set.
BigEndianUnicode:  Encodes in UTF-16 format using the big-endian byte order.
Byte:   Encodes a set of characters into a sequence of bytes.
String:  Uses the encoding type for a string.
Unicode:  Encodes in UTF-16 format using the little-endian byte order.
UTF7:   Encodes in UTF-7 format.
UTF8:  Encodes in UTF-8 format.
Unknown:  The encoding type is unknown or invalid. The data can be treated as binary.

PS C:\> $PSVersionTable.PSVersion.ToString()
7.1.0-preview.3

`ascii`: Uses the encoding for the ASCII (7-bit) character set.
`bigendianunicode`: Encodes in UTF-16 format using the big-endian byte order.
`oem`: Uses the default encoding for MS-DOS and console programs.
`unicode`: Encodes in UTF-16 format using the little-endian byte order.
`utf7`: Encodes in UTF-7 format.
`utf8`: Encodes in UTF-8 format.
`utf8BOM`: Encodes in UTF-8 format with Byte Order Mark (BOM)
`utf8NoBOM`: Encodes in UTF-8 format without Byte Order Mark (BOM)
`utf32`: Encodes in UTF-32 format.

但是,如果您在Jenkins上使用Git插件,则没有“ shallow-since”参数,只有“ depth”一个参数,因此您需要选择固定数量的提交(而不是天数)。它等效于以下Git命令:

git clone --shallow-since=<date> ...