Skip to content

Instantly share code, notes, and snippets.

@MnHung
Last active May 16, 2019 04:47
Show Gist options
  • Save MnHung/e8c42a1540546a2ab5dc985e387306c1 to your computer and use it in GitHub Desktop.
Save MnHung/e8c42a1540546a2ab5dc985e387306c1 to your computer and use it in GitHub Desktop.
Git fetch all branches and move to another remove repository
# 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