如何从git资料库取得最后提交日期? [英] How do I get last commit date from git repository?

查看:108
本文介绍了如何从git资料库取得最后提交日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要git中的最后提交日期.这意味着我程序中的最新更新日期.

I need the last commit date in git. This means the latest update date in my program.

我使用了命令:$ git log -1,但是该命令会给我本地存储库中的日期.而是我需要来自远程存储库的日期.

I used the command : $ git log -1 but this command will give me the date from the local repository. Rather I need date from remote repository.

我尝试了一些如下命令.

I tried some commands as follow.

git log -n 1 origin/Sprint-6.
git rev-parse --verify HEAD

推荐答案

以下命令将很有帮助:

git log -1 --format=%cd 

这将打印一个文件的最新更改日期. -1显示一个日志条目(最新),而--format=%cd显示提交日期. 有关选项的完整说明,请参见 git-log 的文档.

This will print the latest change date for one file. The -1 shows one log entry (the most recent), and --format=%cd shows the commit date. See the documentation for git-log for a full description of the options.

这篇关于如何从git资料库取得最后提交日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆