Git只显示分支和标签的头

x4shl7ld  于 2023-10-14  发布在  Git
关注(0)|答案(2)|浏览(133)

我想对我的仓库中的标签和分支有一个概述,包括本地和远程的。
在搜索这个没有运气之后,我得到了下面的grep(注意,第一行是我常用的git log别名):

alias gitlog='git log --color --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit'
gitlog --all | grep ' \-......('

该grep表达式过滤包含左括号的行,这将给出所需的结果:

* 580c14b - (origin/sa, sa) 
* 1051cad - (HEAD -> mt, origin/bf, origin/de, bf, de) 
| * d19d6d6 - (origin/ms) 
| | * 6139779 - (origin/31)
| | | * 8005a54 - (origin/mr, mr) 
| | | * f1b6f37 - (origin/sp, sp) 
* 7a40270 - (origin/master, origin/HEAD, master) 
* abeba99 - (tag: xx)

但是,我希望得到类似的结果,而不需要求助于grep over git log输出。
我怎样才能得到一个有ref(分支,标签或stash)指向它们的git log提交?

6qftjkof

6qftjkof1#

$ git log --all --decorate --oneline --graph --simplify-by-decoration

* f586332 (HEAD -> master, origin/master, origin/HEAD) Merge branch 'master' of github.com:dockerstuff/docker-jupyterhub-deploy
| * 86bba9c (origin/jupyter-isis-to-gispy-sharing, origin/erim23) fix base and notebook image references
| | * 26c9b4d (origin/simplify_settings) [wip] trying to understand why 500 error
| | | * c1774fa (refs/stash) WIP on simplify_settings: 5356738 [wip] organizing variables
| | |/  
| | * 5356738 (simplify_settings) [wip] organizing variables
| |/  
|/|   
* | a977d21 (origin/blue) Add start script to setup a 'gmap' user
* | 1c6c6a7 (bpsd_tmp) Change internal notebook-hub port, fix user volume permission args
|/  
* e974a8f Initial commit
piah890a

piah890a2#

git show-branch-显示分支及其提交。
git show-branch --all --current-显示远程跟踪分支和本地分支,包括当前分支。

相关问题