get the last modification data of a file in git repo

前端 未结 3 2082
没有蜡笔的小新
没有蜡笔的小新 2021-02-04 06:59

Im trying to find the command to get the last modified date of a file in a local git repo.

Created the repo and have done one commit. Had to edit one file and will commi

3条回答
  •  星月不相逢
    2021-02-04 07:32

    The correct way to do this is to use git log as follows.

    git log -1 --pretty="format:%ci" /path/to/repo/anyfile.any)

    -1 restricts it to the very last time the file changed

    %ci is just one of the date formats you can choose from others here at https://git-scm.com/docs/pretty-formats

    This method is fool proof and 100% accurate.

提交回复
热议问题