如果你的Git版本>=2.13,你可以使用相同的git branch
命令来执行此操作。
它有一个--format
您可以使用该参数根据需要格式化输出。只需像这样运行它即可获得您想要的输出。
git branch --format='%(refname:short)%09%(committerdate)' --sort=-committerdate
您可以添加一些颜色以使其清晰。
git branch --format='%(color:bold green) %(refname:short) %(color:white) %(committerdate)' --sort=-committerdate
Output:
Development Fri Jun 29 10:32:43 2018 +0530
feat-2180 Fri Jun 8 18:01:36 2018 +0530
master Wed May 16 17:19:21 2018 +0530
这是它支持的字段名称列表 -https://github.com/git/git/blob/v2.17.0/ref-filter.c#L328 https://github.com/git/git/blob/v2.17.0/ref-filter.c#L328
=================================================== ===================
Edit:
正如您在评论中提到的;我认为您无法使用以下命令获取提交详细信息ls-remote
独自指挥。刚刚查看了命令的源代码,除了引用和提交哈希之外,它似乎没有返回任何其他值。所以我认为不可能使用这个(如果我错了,请纠正我)。
https://github.com/git/git/blob/maint/builtin/ls-remote.c https://github.com/git/git/blob/maint/builtin/ls-remote.c
如果您愿意进行临时克隆,我建议创建一个 shell 脚本或某种脚本来进行克隆并获取摘要。
这是一个例子:
#!/usr/bin/env bash
REMOTE_URL=$1
git clone -q --depth 1 --bare --no-single-branch $REMOTE_URL /tmp/temp-git-clone
cd /tmp/temp-git-clone
git branch --format='%(color:bold green) %(refname:short) %(color:white) %(committerdate)' --sort=-committerdate
rm -rf /tmp/temp-git-clone
我在中使用了以下参数clone
命令使其更快一点。
--depth 1
= 只会得到最后一次提交
--bare
= 创建一个裸存储库,这意味着不会有
工作目录,它不会复制文件。
--no-single-branch
= 需要这个来告诉克隆命令获取所有
分支机构
如果运行脚本:./summary.sh <your repo url>
它将如您所期望的那样向您显示摘要!
希望能帮助到你 :)