Skip to content

Instantly share code, notes, and snippets.

@esebastian
Created July 5, 2014 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esebastian/a20814371ca71086fd56 to your computer and use it in GitHub Desktop.
Save esebastian/a20814371ca71086fd56 to your computer and use it in GitHub Desktop.
Reset the commit dates to their corresponding author dates
#!/bin/sh
# Reset the commit dates to their corresponding author dates, in the current
# branch. Usually useful to preserve the original timestamps after a rebase.
#
# This action is destructive to your repo's history and this should not
# be performed on a repo that has been shared with others, because it
# will force them to reset their history.
#
# Use at your own risk.
#
# Put the script in your path and invoke it this way:
# git fix-dates
echo "Reseting dates..."
git filter-branch --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE'
[[ $? -eq 0 ]] && echo Done!
[[ $? -ne 0 ]] && echo Error!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment