The situation is this:
I have more than one remote repository - for reference, lets say that one is the "alpha" repository, and we have recently set up a new "beta" repository, which some users have migrated to.
Both repositories have a "master" branch.
How do I set up my local master such that it will attempt to automatically push and pull to and from both the alpha and beta repositories, without manually specifying the remote I want to use each time?
I should elaborate that I don't want to set up two local branches 'master-alpha' and 'master-beta', I want the same local branch to track both remotes.
Add remotes using git remoteYou can set multiple remote URLs to a single remote using git remote. If you don't have a remote named 'all' already, create it using git remote add then use git remote set-url --add to add a new URL to the existing remote. You can cross-check added new remotes using git remote -v .
The command git branch -f --track $BRANCH origin/$BRANCH does the trick.
I don't think it is possible with one git command.
The other alternative would be to define a git alias which would git pull master from one repo, and then git pull master from the other.
But if the history of commits differ too greatly between the two master, that would quickly lead to a massive number of conflicts...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With