跳到主要内容

git commit

commit 的时间

git commit --date
  • Git对commit的记录其实有两套日期,分别是AuthorDate和CommitDate,--date参数只修改了 AuthorDate,而没有修改CommitDate,而且CommitDate是没有参数可以设定的,这两个时间都会被推送给远程,Github在commits视图使用的就是CommitDate.

  • git log 不会按时间排列

  • --date 指定的是 AuthorDate

  • GitHub使用的是 CommitDate

两个时间可以通过环境变量指定

注意windows可能不会生效

#Commit Date
export GIT_COMMITTER_DATE="[date]"



#Author Date
export GIT_AUTHOR_DATE="[date]"