Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
提取早于指定时间段的GIT分支列表_Git_Shell_Bitbucket_Git Bash - Fatal编程技术网

提取早于指定时间段的GIT分支列表

提取早于指定时间段的GIT分支列表,git,shell,bitbucket,git-bash,Git,Shell,Bitbucket,Git Bash,我正在使用下面的GIT命令提取分支列表以及提交者名称和日期。 但是,我想知道如何获取超过90天的分支,而不是获取整个列表 git for-each-ref --count=10 --sort=-committerdate refs/remotes/ --format='%(refname:short) = %(committerdate:short) =%(committername) =%(authorname)'| xargs -L1 | cut -d"/" -f2- >> $a

我正在使用下面的GIT命令提取分支列表以及提交者名称和日期。 但是,我想知道如何获取超过90天的分支,而不是获取整个列表

git for-each-ref --count=10 --sort=-committerdate refs/remotes/ --format='%(refname:short) = %(committerdate:short) =%(committername) =%(authorname)'| xargs -L1 | cut -d"/" -f2- >> $allbrancheslist.txt
以历元格式获取每个引用头的当前日期和提交日期。计算间隔并打印间隔大于或等于7776000秒的参考

git log -1 --pretty=%cd --date=format:%s ${commit}
OP提到:

这意味着Windows,Git2.27(2020年第二季度)已经修复了这一问题

参见(2020年4月9日)和(2020年4月8日)作者。
参见(2020年4月8日)作者。
(于2020年4月22日合并)

:如果可能,使用现代strftime实现 签字人:Matthias Aßhauer
签字人:Johannes Schindelin

Microsoft在Visual Studio 2015中引入了一个新的“通用C运行时库”(
UCRT
)。
UCRT附带了一个支持更多日期格式的
strftime()
实现。
我们将git与旧的“Microsoft Visual C运行时库”(MSVCRT)链接,因此要使用
UCRT strftime()
我们需要使用
DECLARE\u PROC\u ADDR()/INIT\u PROC\u ADDR()从
ucrtbase.dll
加载它

大多数受支持的Windows系统都应该通过Windows update接收UCRT,但在某些情况下,可能只有MSVCRT可用。
在这种情况下,我们只能使用该实现

通过此更改,可以使用例如
%g
%V
日期格式说明符,例如

git show -s --format=%cd --date=format:‘%g.%V’ HEAD
如果没有此更改,用户将在Windows上看到此错误消息:

fatal: invalid strftime format: '‘%g.%V’'
这修复了“缺少对ISO 8601日期格式的支持”


是否有一种方法可以在执行分支提取时限制它,而不是在完成列表签出后控制它。@user3781945抱歉,我不理解您的问题。脚本不需要签出任何分支。尝试执行提供的脚本日期时出现以下错误:有关详细信息,请使用额外操作数“%s”Try“date--help”。致命:无效的strftime格式:“%s”@user3781945我正在使用
GNUBash,版本4.3.48(1)-发行版(x86\u 64-pc-linux-GNU)
。运行
date--help
查看您的
date
是否有获取历元的选项。
git show -s --format=%cd --date=format:‘%g.%V’ HEAD
fatal: invalid strftime format: '‘%g.%V’'