Created
August 9, 2017 12:17
-
-
Save dm/aad8e34a5ee6b542a0bc788375b548ed to your computer and use it in GitHub Desktop.
Partial functions.git.zsh
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
# <snip> | |
# Destructive! Resets all rebased commit dates to COMMITER_DATE | |
git-reset-dates() { | |
echo "Usage: git-reset-dates [ SHA1..HEAD ]" | |
echo "Are you sure you wish to reset git commit dates to COMMITER_DATE? (y/N)" | |
read REPLY | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
if [ -z $1 ]; then | |
git filter-branch --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE' | |
else | |
git filter-branch --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE' $1 | |
fi | |
fi | |
} | |
# Destructive! Resets all rebased commit dates to AUTHOR_DATE | |
git-reset-dates-original() { | |
echo "Usage: git-reset-dates [ SHA1..HEAD ]" | |
echo "Are you sure you wish to reset git commit dates to AUTHOR_DATE? (y/N)" | |
read REPLY | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
if [ -z $1 ]; then | |
git filter-branch --env-filter 'GIT_AUTHOR_DATE=$GIT_COMMITTER_DATE; export GIT_AUTHOR_DATE' | |
else | |
git filter-branch --env-filter 'GIT_AUTHOR_DATE=$GIT_COMMITTER_DATE; export GIT_AUTHOR_DATE' $1 | |
fi | |
fi | |
} | |
# </snip> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment