Skip to content

Instantly share code, notes, and snippets.

@erochest
Last active August 29, 2015 13:56
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 erochest/8830289 to your computer and use it in GitHub Desktop.
Save erochest/8830289 to your computer and use it in GitHub Desktop.
Transfer all the branches to another repo.
#!/bin/bash
SOURCE=origin
DEST=bitbucket
for b in $(git branch -r | grep $SOURCE | grep -v -- '->' | sed 's/origin\///' | tr -d ' '); do
echo $b
git checkout $b
git pull
git push $DEST $b
done
@erochest
Copy link
Author

erochest commented Feb 5, 2014

Some days I should not be allowed to use the shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment