一、有时候想了解目前repo各个仓库近段时间的提交情况,特意花时间写给脚本,让repo 搜索所有仓库下某个日期之后的最新提交。这样可以过滤时间比较久的提交。
二、bash脚本,这里我想了解2021-09-09 07:00时间之后的最新提交情况。
#!/bin/bash repo forall -c 'committime=`git log --after "2021-09-09 07:00" -1 --pretty=format:"%cd"`; if [ "$committime" != "" ]; then pwd echo committime=$committime git log -1 --pretty=format:"%ad" git log -1 --pretty=format:"%cd" git log -1 fi '
三、顺便了解一下git控制显示的记录格式。
git log --pretty=format:" " 控制显示的记录格式,常用的格式占位符写法及其代表的意义如下: 选项 说明 %H 提交对象(commit)的完整哈希字串 %h 提交对象的简短哈希字串 %T 树对象(tree)的完整哈希字串 %t 树对象的简短哈希字串 %P 父对象(parent)的完整哈希字串 %p 父对象的简短哈希字串 %an 作者(author)的名字 %ae 作者的电子邮件地址 %ad 作者修订日期(可以用 -date= 选项定制格式) %ar 作者修订日期,按多久以前的方式显示 %cn 提交者(committer)的名字 %ce 提交者的电子邮件地址 %cd 提交日期 %cr 提交日期,按多久以前的方式显示 %s 提交说明
四、实际运行效果。



