git
› Pro Git
› Atlassian Git Tutorial
› Pro Git 简体中文翻译
› GitX
pktangyue
V2EX  ›  git

安利一个自己整理的 git log alias

  •  2
     
  •   pktangyue · Mar 31, 2016 · 7079 views
    This topic created in 3870 days ago, the information mentioned may be changed or developed.
    [alias]
    glog = log --pretty=format:\"%C(auto)%h %C(magenta)<%ad> %C(green)[%an] %C(blue normal bold)| %Creset%s%C(auto)%d\" --graph --date=short

    效果如图


    希望大家喜欢~
    27 replies  •  2016-04-02 21:07:48 +08:00
    hongfeiyu
    hongfeiyu
    Mar 31, 2016
    1
    3q
    jsonline
    jsonline
    Mar 31, 2016❤️1
    2
    glog='git log --graph --pretty=format:''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'' --abbrev-commit --'
    xi_lin
    xi_lin
    Mar 31, 2016
    3
    不错~
    SelFree
    SelFree
    Mar 31, 2016
    4
    alias.lg=log --color --graph --format=format:'%C(bold blue)%h%C(reset): %C(bold green)(%ad)%C(reset) %C(bold yellow)<%an>%C(reset)%C(bold red)%d%C(reset)%n'' %C(reset)%s%C(reset)' --date=local --abbrev-commit
    SelFree
    SelFree
    Mar 31, 2016
    5
    ```
    SelFree
    SelFree
    Mar 31, 2016❤️1
    6
    ```
    lg=log --color --graph --format=format:'%C(bold blue)%h%C(reset): %C(bold green)(%ad)%C(reset) %C(bold yellow)<%an>%C(reset)%C(bold red)%d%C(reset)%n'' %C(reset)%s%C(reset)' --date=local --abbrev-commit
    ```
    caixiexin
    caixiexin
    Mar 31, 2016
    7
    win 下的 git bash 貌似用不了?
    araraloren
    araraloren
    Mar 31, 2016
    8
    不错,都挺好看。。。
    clino
    clino
    Mar 31, 2016
    9
    最好加一个 --decorate 这样能看到对应的 reference
    smartdie
    smartdie
    Mar 31, 2016
    10
    谢谢,非常棒,借鉴了一下
    Busy
    Busy
    Mar 31, 2016
    11
    Busy
    Busy
    Mar 31, 2016
    12
    授人鱼不如授人以渔
    sunwei0325
    sunwei0325
    Mar 31, 2016
    13
    不错不错, 谢谢楼主分享!
    SpicyCat
    SpicyCat
    Mar 31, 2016
    14
    可以试试 tig
    pktangyue
    pktangyue
    OP
    Mar 31, 2016
    15
    @caixiexin 有啥报错么?
    pktangyue
    pktangyue
    OP
    Mar 31, 2016
    16
    @clino 如果我没理解错的话,'%d' 就是 --decorate 吧,
    pktangyue
    pktangyue
    OP
    Mar 31, 2016
    17
    @Havee 赞授人以渔!
    clino
    clino
    Mar 31, 2016
    18
    @pktangyue 好吧 貌似上面的图是有的
    caixiexin
    caixiexin
    Mar 31, 2016 via Android
    19
    @pktangyue 就是找不到 glog 这个命令, lz 的配置应该是加在用户目录的.gitconfig 文件里吧?
    pktangyue
    pktangyue
    OP
    Mar 31, 2016
    20
    @caixiexin 嗯,要加到[alias]下面, glog 前面有个 tab ,这里发出来没显示出来。
    caixiexin
    caixiexin
    Mar 31, 2016 via Android
    21
    @pktangyue 补上了,还是不行
    pktangyue
    pktangyue
    OP
    Mar 31, 2016❤️1
    22
    @caixiexin
    git config --global alias.glog 'log --pretty=format:"%C(auto)%h %C(magenta)<%ad> %C(green)[%an] %C(blue normal bold)| %Creset%s%C(auto)%d" --graph --date=short'
    试试用命令加进去看看?
    caixiexin
    caixiexin
    Mar 31, 2016
    23
    @pktangyue 也不行 估计 win 下不是这么用的?
    pktangyue
    pktangyue
    OP
    Mar 31, 2016
    24
    @caixiexin 呃,这就不清楚了,你研究下 win 下 gitconfig 怎么配置吧
    GPU
    GPU
    Mar 31, 2016
    25
    root@debian:~/test# git glog
    fatal: bad color value 'auto' for variable '--pretty format'
    *
    root@debian:~/tests#
    pktangyue
    pktangyue
    OP
    Mar 31, 2016
    26
    @GPU 需要 git 版本 1.8.3 才能用 auto ,你可以换成任意一个你想要的颜色
    normal
    black
    red
    green
    yellow
    blue
    magenta
    cyan
    white
    这些可以选择
    sunjourney
    sunjourney
    Apr 2, 2016
    27
    zsh git plugin 可破,glog
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5135 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 01:20 · PVG 09:20 · LAX 17:20 · JFK 20:20
    ♥ Do have faith in what you're doing.