Created
September 28, 2015 21:53
-
-
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 ;)
This file contains hidden or 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
# 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