Last active
August 29, 2015 14:21
-
-
Save ymek/a3f991b1ed46637fef03 to your computer and use it in GitHub Desktop.
Migrate Git Repo's Remote Origin And Set Tracking 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
NEW_REMOTE="[email protected]:your/repo.git" | |
# Rename the old origin | |
# Add the new origin | |
# Push all local branches to new origin and set respective tracking branches | |
git remote rename origin old_origin | |
git remote add origin $NEW_REMOTE | |
git remote push --all -u origin | |
# NOTE: Could benefit from refactor to use a "git clone --mirror" flow | |
# which would push *all* branches on old_origin to the new origin, | |
# not just those locally checked-out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment