Last active
April 19, 2017 09:08
-
-
Save WindomZ/84e8d49b51666d6293632298c78a2407 to your computer and use it in GitHub Desktop.
Usage: ./git-commit-modify-last-time.sh <seconds(like: 86400 = 60 * 60 * 24 (s) = 24 (h)>
This file contains hidden or 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
#!/usr/bin/env bash | |
git stash && \ | |
date=$(date -r $(expr $(date '+%s') + $1) +%s) && \ | |
rm -rf "$(git rev-parse --git-dir)/refs/original/" && \ | |
git filter-branch --env-filter \ | |
"if [ \$GIT_COMMIT = \"$(git rev-parse HEAD)\" ]; then | |
export GIT_AUTHOR_DATE=\"$date\" | |
export GIT_COMMITTER_DATE=\"$date\" | |
export GIT_COMMITTER_NAME=\$GIT_AUTHOR_NAME | |
export GIT_COMMITTER_EMAIL=\$GIT_AUTHOR_EMAIL | |
fi" && \ | |
git stash pop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment