How to push multiple branches from multiple commits?

If you want to push several specific branches (for example branch1 and branch2) you can use:

git push origin branch1 branch2 

In Git >= 2.4 this operation can be done atomically (i.e. if it fails to push any of the branches specified nothing will be pushed):

git push --atomic origin branch1 branch2 

To push all branches (refs under refs/heads), use the following command (where origin is your remote):

git push origin --all

You can also set push.default to matching in your config to push all branches having the same name on both ends by default. For example:

git config --global push.default matching

Since Git 2.0 the default is simple which is the the safest option.

Tags:

Git

Github