Last active
May 16, 2019 04:47
-
-
Save MnHung/e8c42a1540546a2ab5dc985e387306c1 to your computer and use it in GitHub Desktop.
Git fetch all branches and move to another remove repository
This file contains 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
# git clone | |
git clone git@xxx1 | |
# fetch all remove branches name | |
for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done | |
# add the new remove repository | |
git remote add new-origin git@xxx2 | |
# push all sources and tags | |
git push --all new-origin | |
git push --tags new-origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment