Git log --pretty as git log --graph --oneline

Git log --pretty as git log --graph --oneline

我正在尝试复制 git log --graph --online 添加了一些信息。问题是我当前的别名显示了所有分支的日志,如下所示:

$ git lg
* 7683440c6 - (origin/Branch1, Branch1) Message1 (48 minutes ago) by Author1
* 297b8a9cc - (HEAD -> Branch2, origin/Branch2) Message2 (4 days ago) by Author2
| * a21d8248e - (origin/Branch3, Branch3) Message3 (4 days ago) by Author2
| * 11f0f5aea - (origin/Branch4) Message4 (5 days ago) by Author3
| * b9b816d84 - (origin/Branch5) Message5 (5 days ago) by Author4
|/
| * 1acf9435f - (origin/Branch6, Branch6) Message6 (5 days ago) by Author1
|/
* 982aab25a - Message7 (5 days ago) by Author5
* 48df9d049 - Message8 (5 days ago) by Author5

而我想要的是这样的:

$ git log --graph --oneline
* 297b8a9cc (HEAD -> Branch2, origin/Branch2) Message2
* 982aab25a Message7
* 48df9d049 Message8
* b409cbed5 Message9
* 2868a5794 Message10
* 46cd8e98f Message11
* 3c6ac0b8d Message12

如您所见,我在 Branch2git log --graph --oneline 仅向我显示此分支上的内容,但我的别名显示我的其他信息(对于其余分支),但我不知道我不想那样。 如何在我的别名上复制上述命令,以便我只有当前分支上的提交(加上 Branch2 位于顶部的提交 - 例如 git log --graph --oneline)?

我当前的别名如下所示:

lg = log --first-parent --graph --pretty=format:'%C(yellow)%h%Creset -%C(auto)%d%Creset %s %C(cyan)(%cr) %Cresetby %C(bold blue)%aN%Creset' --abbrev-commit --date=relative --branches

从您的别名中删除 --branches


--branches 就像您在命令行上明确写下所有分支的名称一样。

如果您从 git lg 别名中删除 --branches,您仍然可以通过键入

查看所有分支
git lg --branches