Last active
April 19, 2017 09:05
-
-
Save WindomZ/d2bd2f3b51f1ac335b0bf61e3a32878e to your computer and use it in GitHub Desktop.
Usage: ./git-commit-modify-last-time.sh <date(like: Tue, 07 Feb 2017 07:00:00 +0800)>
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 -d "$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