Created
July 5, 2014 18:15
-
-
Save esebastian/a20814371ca71086fd56 to your computer and use it in GitHub Desktop.
Reset the commit dates to their corresponding author dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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