如何git log --graph只显示分支头?

时间:2019-11-15 19:53:41

标签: git

如何使用git log --graph仅包括当前分支头的提交?

例如

$ git log --graph --all --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

给予:

*   fa3d2f92d - (HEAD -> feat/pullupstream) Merge remote-tracking branch 'foundation/master' into feat/pullupstream (48 minutes ago) <me>
|\  
* | a12984977 - (myuser/feat/chainconfig-equivalence-test, mycompany/feat/chainconfig-equivalence-test, feat/istanbul-featureblocks, feat/chainconfig-equivalence-test) Makefile: add test-multigeth command (3 hours ago) <Jeff>
* | 7c471933a - tests: add equivalence-proof tests for fork feature configs (3 hours ago) <Jeff>
* | 47189785b - params: remove and comment CheckConfigForkOrder (3 hours ago) <Jeff>
* | 87d575b8f - params: remove unused IsEIP158 method (3 hours ago) <Jeff>
* | aaf58e484 - core/vm: fix commented fork names (3 hours ago) <Jeff>
* | 1771de385 - core: prefer EIP161F feat instead of EIP158 (3 hours ago) <Jeff>
* | 30ded24cc - tests: s/IsEIP158/IsEIP161F/ (4 hours ago) <Jeff>
* | 7839340cc - Makefile: add env var to enable args to test cmd (4 hours ago) <Jeff>
* | c398d1231 - (mycompany/feat/verbose-test-logs, feat/verbose-test-logs) build: add test cmd flag -v for verbose logs (4 hours ago) <Jeff>
| | * 488a69b8b - (feat/x-chainspec) consensus/ethash,params: refactor HasECIP1017->IsECIP1017F (78 minutes ago) <Jeff>
| | * 456aa8cc9 - params: add ECIP1017FBlock to satisfy forkid implementation (78 minutes ago) <Jeff>
| | * b945c3902 - core/forkid: test gatherForks func against ETC conf (78 minutes ago) <Jeff>
| | * 3e0527dcb - cmd/utils: refactor datadir from --chain context (78 minutes ago) <Jeff>
| | * 6b1d6b6d5 - cmd/utils: refactor --[chain] -> genesis logic (78 minutes ago) <Jeff>
| | * 54e5272c2 - chainspec,cmd/faucet|geth|utils,eth,mobile,params: refactor NetworkId (78 minutes ago) <Jeff>
| | * aa18677ce - chainspec: init support for Parity/Clique config (78 minutes ago) <Jeff>
| | * e46bcfb8e - cmd/puppeth,+chainspec: move chainspec data structures to own package (78 minutes ago) <Jeff>
| | * 6ec3edff4 - cmd/puppeth: export ChainSpecs and New_ methods (78 minutes ago) <Jeff>
| | *   864e57887 - (multi-geth/master, master) Merge pull request #124 from mycompany/fix/mordor-genesis-timestamp (9 hours ago) <Tang>
| | |\  
| | | * dc17c5d96 - (mycompany/fix/mordor-genesis-timestamp, fix/mordor-genesis-timestamp) core: set mordor genesis block timestamp (2 days ago) <Jeff>
| | |/  
| | | * fde76dc96 - (mycompany.technology.go-technology/feat/makefile-test-cmd-args-ef, feat/makefile-test-cmd-args-ef) Makefile: add env var to enable args to test cmd (2 hours ago) <Jeff>
| | |/  
| |/|   
| | | * b77fa876f - (mycompany.technology.go-technology/feat/verbose-test-logs-ef, feat/verbose-test-logs-ef) build: add test cmd flag -v for verbose logs (2 hours ago) <Jeff>
| | |/  
| |/|   
| * | 738b51ae3 - (foundation/master, foundation/HEAD, mycompany.technology.go-technology/foundation-master, foundation-master) core/vm: fix tracer interface parameter name (#20294) (11 hours ago) <nejsad4>
| * | f03b2db7d - params: finish sentence in comment (#20291) (23 hours ago) <myuser>
| * | 49d1a032d - build: gather info to investigate why builds fail on ARM (#20281) (30 hours ago) <Guillaume>
| * | 765fe446c - whisper/whisperv6: fix staticcheck issues (#20288) (35 hours ago) <Guillaume>

但是我只希望使用分支引用进行提交:

*   fa3d2f92d - (HEAD -> feat/pullupstream, gogs/feat/pullupstream) Merge remote-tracking branch 'foundation/master' into feat/pullupstream (49 minutes ago) <me>
|\  
* | a12984977 - (myuser/feat/chainconfig-equivalence-test, mycompany/feat/chainconfig-equivalence-test, feat/istanbul-featureblocks, feat/chainconfig-equivalence-test) Makefile: add test-multigeth command (3 hours ago) <Jeff>
* | c398d1231 - (mycompany/feat/verbose-test-logs, feat/verbose-test-logs) build: add test cmd flag -v for verbose logs (4 hours ago) <Jeff>
| | * 488a69b8b - (feat/x-chainspec) consensus/ethash,params: refactor HasECIP1017->IsECIP1017F (80 minutes ago) <Jeff>
| | *   864e57887 - (multi-geth/master, master) Merge pull request #124 from mycompany/fix/mordor-genesis-timestamp (9 hours ago) <Tang>
| | |\  
| | | * dc17c5d96 - (mycompany/fix/mordor-genesis-timestamp, fix/mordor-genesis-timestamp) core: set mordor genesis block timestamp (2 days ago) <Jeff>
| | |/  
| | | * fde76dc96 - (mycompany.technology.go-technology/feat/makefile-test-cmd-args-ef, feat/makefile-test-cmd-args-ef) Makefile: add env var to enable args to test cmd (2 hours ago) <Jeff>
| | |/  
| |/|   
| | | * b77fa876f - (mycompany.technology.go-technology/feat/verbose-test-logs-ef, feat/verbose-test-logs-ef) build: add test cmd flag -v for verbose logs (2 hours ago) <Jeff>
| | |/  
| |/|   
| * | 738b51ae3 - (foundation/master, foundation/HEAD, mycompany.technology.go-technology/foundation-master, foundation-master) core/vm: fix tracer interface parameter name (#20294) (11 hours ago) <nebojsa94>

1 个答案:

答案 0 :(得分:1)

您正在寻找--simplify-by-decoration选项。

您还可以使用--decorate-refs / --decorate-refs-exclude过滤要保留的参考文献:

# will only keep branches (not tags) starting with "feature/" or "bug/" :
git log --oneline --graph --simplify-by-decoration
    --decorate-refs=refs/heads/feature
    --decorate-refs=refs/heads/bug

# will keep all refs and exclude tags starting with "private/" :
git log --oneline --graph --simplify-by-decoration
    --decorate-refs-exclude=refs/tags/private
相关问题