Skip to content

Instantly share code, notes, and snippets.

@josedulanto
Created September 28, 2015 21:53
Show Gist options
  • Save josedulanto/57fb813b78db634b8b71 to your computer and use it in GitHub Desktop.
Save josedulanto/57fb813b78db634b8b71 to your computer and use it in GitHub Desktop.
The easiest way to move a repo from one place to another including all branches ;)
# Do the usual clone of a repository
git clone <repo>
# Create local branches from remote and track them
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
# Set the new repo
git remote set-url origin <new-repo>
# Push everything to the new repo
git push --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment