windows - 获取所有分支的日期、散列和分支名称

标签 windows git

以下命令列出了我所有本地分支的最后提交哈希和分支名称:

git show-ref --heads

输出:

<hash> <branch-1>
<hash> <branch-2>
...
<hash> <branch-n>

但是,我还想查看每个分支的日期。以下命令仅显示当前分支上最后一次提交的日期和哈希,但不显示分支名称:

git log -1 --format="%ci %H"

输出:

<date> <hash>

我怎样才能得到两者结合的结果?

<date> <hash> <branch-1>
<date> <hash> <branch-2>
...
<date> <hash> <branch-n>

我使用的 Windows 10 没有花哨的命令环境,只有基本的命令提示符。

最佳答案

我能够稍微调整 this great GitHub post 以获得以下内容:

$ for branch in `git branch | grep -v HEAD`;do echo -e
      `git show --format="%ci %cr %H" $branch | head -n 1` \\t$branch; done | sort -r

输出:

2017-03-07 11:38:38 +0800 2 hours ago 87ed1306a1c06576043cd398097a1dc0ec456632 branch1
2017-03-07 02:50:06 +0000 3 hours ago 577fe106a9eb5763cbfd5bce87cfa9448ef52ca8 master
2017-03-07 02:50:06 +0000 3 hours ago 577fe106a9eb5763cbfd5bce87cfa9448ef52ca8 branch2
2017-03-03 17:07:05 +0800 4 days ago 419a23b246ad932c9659b70fded4b1362e92d884  branch3

关于windows - 获取所有分支的日期、散列和分支名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42640696/

相关文章:

windows - 无法在 Git Bash 中将 Meld 设置为 diff 工具

windows - 如何在没有 GUI 的情况下运行 makecert.exe?

c++ - windows下如何检测文件是否被其他进程打开

git - 如何在同一台机器上使用和克隆 github 和 aws (CodeCommit) 存储库?

git - STS 中的 Git 插件问题

git - 哪些 $VARIABLES 可以从 git-gui 传递给外部工具?

php - 从 Internet Explorer 将原始 EPL2 打印到 Zebra Thermal

windows - 让 vim 在 mobaxterm 中工作

linux - 差不多了!如何向 bash 提示符添加另一种 git status 颜色?

git - 有没有办法强制 git merge 始终使用外部 merge 工具?