首页 > 解决方案 > Git如何在一行中查看回购的前8个提交?

问题描述

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

git log --reverse --oneline

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

git log --reverse --oneline -8

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

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

标签: gitcommand-line-interfacegit-log

解决方案


尝试

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

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

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


推荐阅读