如何用过去的日期创建一个git commit? [英] How to create a git commit with date in the past?

查看:211
本文介绍了如何用过去的日期创建一个git commit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经搜索过了,据我了解,可以使用 git commit --date



如果有人能够澄清这一点并举例说明日期格式,我将非常感激。 / p>

解决方案

例如 - date =Wed Feb 16 14:00 2011 +0100

$ b

来自kernel.org:


DATE FORMATS

p>

GIT_AUTHOR_DATE,GIT_COMMITTER_DATE环境变量和
- date 选项支持以下日期格式:



Git内部格式其中
是自UNIX纪元以来的秒数。
是与UTC的正数或负数偏移量。对于
示例,CET(即UTC提前2小时)为+0200。

RFC 2822标准电子邮件格式,如RFC 2822所述,用于
例子Thu,2005年4月7日22:13:13 +0200。

ISO 8601 ISO 8601标准规定的时间和日期,例如
2005- 04-07T22:13:13。解析器也接受一个空格而不是T
字符。


来源: http://www.kernel.org/pub/software/scm/git/docs/ git-commit.html


I wonder how would you create a commit in the past?

I've searched for it, and as far as I understand one can use git commit --date""

I would really appreciate if someone could clarify this and give an example of the date format.

解决方案

For example --date="Wed Feb 16 14:00 2011 +0100"

From kernel.org:

DATE FORMATS

The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables and the --date option support the following date formats:

Git internal format It is , where is the number of seconds since the UNIX epoch. is a positive or negative offset from UTC. For example CET (which is 2 hours ahead UTC) is +0200.

RFC 2822 The standard email format as described by RFC 2822, for example Thu, 07 Apr 2005 22:13:13 +0200.

ISO 8601 Time and date specified by the ISO 8601 standard, for example 2005-04-07T22:13:13. The parser accepts a space instead of the T character as well.

source: http://www.kernel.org/pub/software/scm/git/docs/git-commit.html

这篇关于如何用过去的日期创建一个git commit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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