簡體   English   中英

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

[英]Git log --pretty as git log --graph --oneline

我正在嘗試復制git log --graph --oneline並添加了一些信息。 問題是我當前的別名向我顯示了所有分支的日志,如下所示:

$ 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

如您所見,我在Branch2上,而git 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM