Last active
August 29, 2015 14:06
-
-
Save vermiculus/e9abc96db3efc9705add to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Usage: | |
# | |
# git-unite "User Name" "[email protected]" \ | |
# "[email protected]" \ | |
# "[email protected]" \ | |
# ... | |
name="$1" | |
email="$2" | |
git config user.name "$name" | |
git config user.email "$email" | |
shift 2 | |
export git_new_name="$name" | |
export git_new_email="$email" | |
for old_email in $*; do | |
echo "$old_email..." | |
export git_old_email="$old_email" | |
git filter-branch --force --env-filter ' | |
if [ "$GIT_COMMITTER_EMAIL" = "$git_old_email" ] | |
then | |
export GIT_COMMITTER_NAME="$git_new_name" | |
export GIT_COMMITTER_EMAIL="$git_new_email" | |
fi | |
if [ "$GIT_AUTHOR_EMAIL" = "$git_old_email" ] | |
then | |
export GIT_AUTHOR_NAME="$git_new_name" | |
export GIT_AUTHOR_EMAIL="$git_new_email" | |
fi | |
' --tag-name-filter cat -- --branches --tags | |
echo "$old_email... done." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment