A developer managed to commit some code with a future date--March 1, 2013, to be exact
git show --format=fuller <SHA>
AuthorDate: Fri Mar 1 17:28:26 2013 +0300
CommitDate: Fri Mar 1 17:29:38 2013 +0300
This is (a) misleading, and (b) blocking Jira from finding "new" commits that are tagged with Jira ticket numbers (there have been no commits since Mar 1, 2013--and won't be for 6 months yet)
I have found examples of how to use git filter-branch
to correct the date, e.g.
http://git.661346.n2.nabble.com/date-change-of-commit-td3887606.html :
git filter-branch --env-filter '
if [ $GIT_COMMIT = <sha1> ]; then
export GIT_AUTHOR_DATE="1112911993 -0700"
export GIT_COMMITTER_DATE="1112911993 -0700"
fi
'
But they come with warnings of dire consequences. Answers to any one or more of the following questions would be appreciated.
- What is your experience using the above method to change a commit date?
- What are the consequences to others using the repository?
- What are the consequences to outstanding feature or deployment branches off of the main branch?
- Is there any better way to do this?