When I commited my work, the pc date was 02/13/2014, but the correct date was 01/13/2014. Is possible the change commit date to the correct date?
Asked
Active
Viewed 9,934 times
15
-
like here? http://stackoverflow.com/questions/454734/how-can-one-change-the-timestamp-of-an-old-commit-in-git – x29a Jan 14 '14 at 11:38
-
If your commit already in public places, for example, be pushed, then generally speaking, you should not change it, because this will cause chaos in these other repositories. – Lee Duhem Jan 14 '14 at 12:24
1 Answers
25
If it is your latest commit:
git commit --amend --date="Wed Jan 13 12:00 2014 +0100"
If it is for example your 5th last commit, you can do an interactive rebase and edit the commit:
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
Keep in mind that this rewrites history.