Display last git commit comment

前端 未结 10 688
南旧
南旧 2020-12-02 03:36

Often during a commit ($ git -commit -m \"\"), I wish to read my last comment to remember what progress I have made. Is there an easy way to directly access the

10条回答
  •  情书的邮戳
    2020-12-02 04:03

    You can use

    git show -s --format=%s
    

    Here --format enables various printing options, see documentation here. Specifically, %smeans 'subject'. In addition, -s stands for --no-patch, which suppresses the diff content.

    I often use

    git show -s --format='%h %s'
    

    where %h denotes a short hash of the commit

    Another way is

    git show-branch --no-name HEAD
    

    It seems to run faster than the other way.

    I actually wrote a small tool to see the status of all my repos. You can find it on github.

提交回复
热议问题