Reputation: 3819
Recall that:
git remote add origin https://github.com/user/repo.git //Set a new remote
git remote -v //Verify new remote
origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)
Onto local branches, we can set a default policy for git push
and git pull
configuring the parameter push.default
. For example one policy is matching
:
git config --global push.default matching
as result, every time we execute git push
, this will push all name-matching branches of the local repository to the remote repository origin
.
If there are more remotes (i.e. not only origin
) how the policy matching
apply?
Upvotes: 0
Views: 109
Reputation: 38639
No, git push
will not push all matching branches. If you push a branch and you do not have configured or given to what it should be pushed, this branch will be pushed to a name-matching branch. If you do git push --all
it will push all to either the configured push location or otherwise to name-matching branches. But no matter what you also either have configured to which remote to push or you give it on the commandline e. g. with git push --all origin
. The push.default
setting only cares about matching branchnames. It does not care about selecting which remote to push to.
Upvotes: 1