【发布时间】:2014-02-02 10:54:09
【问题描述】:
当我提交我的工作时,电脑日期是 02/13/2014,但正确的日期是 01/13/2014。是否可以将更改提交日期更改为正确的日期?
【问题讨论】:
-
如果你的commit已经在公共场所,比如被push了,那么一般来说,你不应该改变它,因为这会导致这些其他仓库的混乱。
标签: git
当我提交我的工作时,电脑日期是 02/13/2014,但正确的日期是 01/13/2014。是否可以将更改提交日期更改为正确的日期?
【问题讨论】:
标签: git
如果是你的最新提交:
git commit --amend --date="Wed Jan 13 12:00 2014 +0100"
例如,如果是您的最后 5 次提交,您可以进行交互式 rebase 并编辑提交:
git rebase -i HEAD~5
<find the commit and change 'pick' to 'e', save and close file>
git commit --amend --date="Wed Jan 13 12:00 2014 +0100"
git rebase --continue
记住这个rewrites history。
【讨论】: