Skip to content

Instantly share code, notes, and snippets.

@thinkier
Last active April 26, 2020 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkier/a7b0521abd5ceefad76b655252506620 to your computer and use it in GitHub Desktop.
Save thinkier/a7b0521abd5ceefad76b655252506620 to your computer and use it in GitHub Desktop.
Updates usernames on your old git repositories.
#!/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