I'd like to manually control the git commit timestamp so that my GIT_COMMITTER_DATE always matches the GIT_AUTHOR_DATE. I've seen many solutions using filter-branch to rewrite history, but I'd rather be proactive about this and put the logic in a git hook so that it always matches going forward.
But I find that while these variables work fine if defined in the environment where git is invoked, they do not seem to have any effect when they are defined inside the pre-commit git hook. Eg:
# this works if run directly on cmd line, but not inside the pre-commit hook
export GIT_AUTHOR_DATE='Mon, 11 Aug 2014 11:25:16 -0400'
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
Is there any way to dynamically adjust these values inside a git hook so that commits automatically have the desired timestamps? I'm on git version 1.8.5.2