Git: Dealing with Multiple Remote URLs
Adding multiple remote URLs to your codebase:
Here is the step-by-step guide, very well written!
How to synchronize two remote Git repositories.
Imagine you have two repository URLs, and want to synchronize them so that they contain the same thing.
Pull and push from multiple remote URLs:
- To pull all branches from multiple remotes:
git pull --all
- To pull specific branch from multiple remotes:
git pull --all <branch>
- To push all branches to multiple remotes:
git remote | xargs -L1 git push --all
- To push specific branch to multiple remotes:
git remote | xargs -L1 -I R git push R <branch>
For more info on git push commands, checkout the answer at the stack overflow.
Able to push to all git remotes with the one command?
If you want to always push to repo1, repo2, and repo3 but always pull only from repo1, set up the remote 'origin' as…
git remote remove <url_name>
git remote rename <url_oldname> <url_newname>