2014-01-14 53 views
1

當我提交我的工作時,pc日期爲2014年2月13日,但正確日期爲01/13/2014。更改提交日期可能是正確的日期嗎?是否可以在git上更改提交日期?

+0

像這裏? http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git – x29a

+0

如果你的提交已經在公共場所進行,例如,被推送,那麼一般來說,你不應該改變它,因爲這會導致這些其他庫的混亂。 –

回答

6

如果這是你的最新承諾:

git commit --amend --date="Wed Jan 13 12:00 2014 +0100" 

如果例如你5最近一次提交,你可以做一個互動的底墊和編輯提交:

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

+0

請記住,這會重寫歷史記錄。 – Abizern

+0

@Abizern正確,更新了答案。 – Agis

+0

@Abizern:毫不誇張地說。 –

相關問題