Pretty git branch graphs

前端 未结 30 1820
情话喂你
情话喂你 2020-11-22 01:34

I\'ve seen some books and articles have some really pretty looking graphs of git branches and commits. How can I make high-quality printable images of git history?

30条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 02:00

    This is my take on this matter:

    Screenshot:

    Usage:

    git hist - Show the history of current branch

    git hist --all - Show the graph of all branches (including remotes)

    git hist master devel - Show the relationship between two or more branches

    git hist --branches - Show all local branches

    Add --topo-order to sort commits topologically, instead of by date (default in this alias)

    Benefits:

    • Looks just like plain --decorate, so with separate colors for different branch names
    • Adds committer email
    • Adds commit relative and absolute date
    • Sorts commits by date

    Setup:

    git config --global alias.hist "log --graph --date-order --date=short \
    --pretty=format:'%C(auto)%h%d %C(reset)%s %C(bold blue)%ce %C(reset)%C(green)%cr (%cd)'"
    

提交回复
热议问题