git - Push remote specific branches with different names -


lets have origin branch called master checked out by;

>> git checkout master switched branch 'master' branch up-to-date 'origin/master' 

now add remote fork branch called master checked out by;

>> git checkout -b fork-master fork/master switched branch 'fork-master' branch up-to-date 'fork/master' 

this knows remote given branch belongs to, , references correct origin.

lets want push origin i'd this;

>> git push 

which update origin/master changes (duh).

below 2 examples of pushes;

example 1 **correct!**; >> git push fork fork-master:master  example 2 **fails**; >> git push fork --all 

this automatically pushes fork branches origin except branch master rejected (in case changes made).

what thought example #2 push fork-master fork/master, isn't happening.

can push remote specific branches @ once without having point them correct remote branch name?

i'm asking because there lot of branches time time push.

configure default.push upstream

git config default.push upstream 

then, setup local branches track respective remote branch:

git checkout --track -b fork-master fork/master 

use git branch command verify each branch has current upstream:

git branch -vv 

you can use git push <remote> <branch> push each branch branch@{upstream} automatically:

git push fork fork-master fork-test fork-updates fork-123 

i'm afraid there no way tell git push branches have upstream set branch of specific remote.

but better specific anyway passing branches want pushed on command line. lots of config options change behavior of push, better on safe side.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -