Last active
October 31, 2016 12:22
-
-
Save adriaPerez/18591d96a4038a2feb24384e49121f9e to your computer and use it in GitHub Desktop.
Rebase commits with incorrect creator data
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
#!/bin/sh | |
git filter-branch -f --env-filter ' | |
OLD_EMAIL="[email protected]" | |
CORRECT_NAME="Your Correct Name" | |
CORRECT_EMAIL="[email protected]" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" | |
fi | |
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_AUTHOR_NAME="$CORRECT_NAME" | |
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" | |
fi | |
' --tag-name-filter cat -- --branches --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ideally, you want to
checkout -b bug/rebase-commits
before/after running this code and then do agit push origin bug/rebase-commits
to perform a safe PR with the changes. Alternativelly, you can also perform agit push -f
.