Is there a way in git to obtain a push date for a given commit?

后端 未结 8 1969
眼角桃花
眼角桃花 2020-11-27 12:25

I am wondering if there is a way to view a push date associated with each commit in the git log. If that is not possible, is there a way to see all the commits under a cert

相关标签:
8条回答
  • 2020-11-27 12:59

    It took me an insanely long time to gather scattered information and finally find the very best answer to this question, but now I know I have it. In just two lines, no code and no hooks:

    # required for a bare repo
    git config core.logAllRefUpdates true
    
    git reflog --date=local master
    

    Simple at last.

    Warning: you probably want to override the default values of gc.reflogExpire and gc.reflogExpireUnreachable. Check git help reflog for details and to understand how and why this works.

    The two commands above must be run inside the clone you push to. If that is not possible then an approximation is to run in another, permanent clone:

    git fetch               origin        # often and *regularly*
    git reflog --date=local origin/master
    

    Never delete this permanent clone or you will lose the dates.

    0 讨论(0)
  • 2020-11-27 13:04

    I guess you can use next notation to obtain the push date: git log -g --date=local

    0 讨论(0)
提交回复
热议问题