Last active
April 26, 2020 02:01
-
-
Save thinkier/a7b0521abd5ceefad76b655252506620 to your computer and use it in GitHub Desktop.
Updates usernames on your old git repositories.
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
#!/bin/sh | |
### | |
### License: Public Domain, or the equivalent in your jurisdiction | |
### USE AT YOUR OWN RISK, I WILL NOT TAKE ANY RESPONSIBILITY IF YOU USED THIS AND FUCKED UP YOUR REPOSITORY. | |
### | |
### # Description | |
### Updates usernames on your old repositories. | |
### | |
# I know it's a bad hack but I'm too lazy to even do the replace command in an editor | |
$(sleep 0.2; sed -i 's/^pick/edit/g' .git/rebase-merge/git-rebase-todo)& | |
git rebase -i --root | |
while true; do | |
git commit --amend --author="$(git config user.name) <$(git config user.email)>" --no-edit | |
RESULT=$(git rebase --continue 2>&1) | |
if [[ $RESULT == *"Successfully rebased"* ]]; then | |
break | |
fi | |
done | |
git log | |
echo "Press Enter to push, Ctrl-C to abort." | |
read | |
git push -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment