Skip to content

Instantly share code, notes, and snippets.

@johnbuhay
Created December 24, 2015 18:29
Show Gist options
  • Save johnbuhay/cfed782ed796ed342a37 to your computer and use it in GitHub Desktop.
Save johnbuhay/cfed782ed796ed342a37 to your computer and use it in GitHub Desktop.
git_move() { # where $1 is your origin name and $2 is the new origin url
git fetch --all
git pull --all
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; done
git remote remove $1
git remote add $1 $2
for b in `git branch | grep -v -- '*'`; do git push -u origin $b; done
git push --tags
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment