So, the situation is like this: Say I have 3 branches in my local git repo: master, dev, staging.
Now, I have different servers for each branch that I want to push to.
For example I have set prodS (prodServer) as remote to master and have it mapped to master(git push -set--upstream prodS master). So that git push
pushes master to prodS when I have checkedout master.
Similarly, devS for dev branch, stagingS for staging branch
When my dev and staging branches are ready for push, (Regardless of which branch I have currently checkedout,) I want to be able to run a single command that pushes dev to devS and staging to stagingS; instead of having to switch to each branch and then run git push
or run git push devS dev
and so forth for each branch since I already mapped dev to devS/dev.
I'm aware that multiple URLs can be added to a remote. But that is not what I'm looking for. Say there are already multiple remotes added to each of the branches. But I added them to a particular branch because I want only that particular branch on those remote/s. That's already ok and working.
Is there such an option in git itself? Or the only option here maybe some other workaround like a script?
EDIT: To simpify, and make it easier to understand the question,
If git pull --all
pulls from all remote branches tracked by all local branches; shouldn't git push --all
work in similar way?