0

我正在使用 windows powershell,我想在一行中查看 repo 的前 8 个提交。

git log --reverse --oneline

显示我想要的,但太多了。我只想要 8 次提交。

git log --reverse --oneline -8

在一行中显示 8 个,但最后 8 个提交,而我想要前 8 个提交。

如何在一行中显示前 8 个提交?

4

2 回答 2

1

尝试

git log --reverse --oneline --pretty=format:'%h %aI | %s%d [%an]' | head -8

where--pretty=format:'%h %aI | %s%d [%an]'完全是可选的,但我喜欢拥有它。:)

当然,您也可以更改8为您想查看的任何数量的提交。

于 2021-02-14T04:45:04.337 回答
0

这最终奏效了

git log --reverse --oneline | 选择对象-前 8

这是使用 syohey 建议的样式的漂亮格式

git log --reverse --oneline --pretty=format:'%h %aI | %s%d [%an]' | 选择对象-前 8

head -8未被识别,我猜powershell不支持它。后来,我发现Select-Object -First 8是 powershell 对应物,或者至少是我想要的工作解决方案。

于 2021-02-14T05:46:45.660 回答