Output of git branch in tree like fashion

前端 未结 6 865
野的像风
野的像风 2020-12-04 04:34

Right now, when I type \"git branch\"

it lists my branches in an arbitrary order.

What I would prefer would be if \"git branch\" listed my output in a tree l

6条回答
  •  生来不讨喜
    2020-12-04 05:31

    It's not quite what you asked for, but

    git log --graph --simplify-by-decoration --pretty=format:'%d' --all
    

    does a pretty good job. It shows tags and remote branches as well. This may not be desirable for everyone, but I find it useful. --simplifiy-by-decoration is the big trick here for limiting the refs shown.

    I use a similar command to view my log. I've been able to completely replace my gitk usage with it:

    git log --graph --oneline --decorate --all
    

    I use it by including these aliases in my ~/.gitconfig file:

    [alias]
        l = log --graph --oneline --decorate
        ll = log --graph --oneline --decorate --branches --tags
        lll = log --graph --oneline --decorate --all
    

    Edit: Updated suggested log command/aliases to use simpler option flags.

提交回复
热议问题