Say I added a new remote repo under my project folder by:
git remote add origin2 ADDRESS_OF_NEW_REMOTE_REPO
then, I start to push my code to my new remote repo. Locally, my branch name is “develop“, I want to push to my new remote repo with a different branch name, say “production“, can I simply do this by command:
git push origin2 production
though locally, I am under branch “develop” ? What is the correct way to do this? and what potential problems could be caused by doing this?
(
yourremotenamehere is remote name, often “origin”, “github”, “heroku” or similar)So for you something like:
For the most cases I think I would just rename the local branch to avoid confusion, if it’s possible.
This way it is easier to keep track as to what branch references which.
I understand though that for example Heroku would only deploy from master branch, so sometimes you do want to have the names separate.