从根本上说, Git 不知道提交的时间,除非Git本身具有提交:提交和提交者的两个日期和时间标记是提交的一部分。
这意味着基于提交者时间戳的任何排序或选择都要求您具有提交。因此,您需要将要馈入排序算法的每个分支的每个尖端提交信息按日期进行排序,或馈入选择器。
仅 个其他选项是获取其他一些Git(已经具有这些提交)或系统来为您进行排序或选择,或者交出日期戳(带或不带其余的提交)。标准Git并没有内置任何东西来获得比整个提交要少的值, 1 ,但是各种提供程序都有可以用来获取日期戳的API。要使用这些功能,您必须适当地退出Git。 (您的问题仅被标记为git;添加github以获得特定于GitHub的答案,或者因为答案在其中而只需浏览their API ...)
1 Git开发人员称其为“承诺包”。他们还没有准备好黄金时段。
,
这是一项黑客工作,它演示了一个不因为不使用API而不应该这样做的原因。但是,您不需要API密钥,因此任何人都可以使用该咒语。
如果您对Github确定的 active 的含义感到满意,则:
打击壳
curl https://github.com/raspberrypi/linux/branches/active > branches-active.html
grep 'data-branch-name' branches-active.html | sed -r 's/^.*data-branch-name="(.*?)"(.*$)/git remote set-branches --add origin \1/'
发射:
git remote set-branches --add origin rpi-5.4.y
git remote set-branches --add origin rpi-5.3.y
git remote set-branches --add origin legacy_screen_blanking_update
git remote set-branches --add origin rpi-5.2.y
git remote set-branches --add origin rpi-4.19.y-rt
git remote set-branches --add origin rpi-5.1.y
git remote set-branches --add origin rpi-5.0.y
git remote set-branches --add origin rpi-4.20.y
git remote set-branches --add origin avs2
git remote set-branches --add origin rpi-4.14.y-rt
如果要从最近的提交日期起进行微调:
grep 'time-ago' branches-active.html | sed -r 's/^.*datetime="(....-..-..).*$/\1/'
2019-11-05
2019-10-28
2019-10-28
2019-10-28
2019-09-16
2019-09-23
2019-09-23
2019-09-23
2019-09-05
2019-05-28
天真脚本(硬编码,无参数)证明了这一点:
https://gist.github.com/maphew/1b706e66e87919dbd2538f21b6ea9f26
来源:
本文链接:https://www.f2er.com/3163248.html