I did changes in my local branch. Then I checkout to my master branch and merge it with my local branch. Now I want to push the changes in the master branch to specific branch at the remote. Say, we are 5 Developers. Each one having their own branch at remote repo. If I modified something at my local repo, I should push my work on the branch which is named in my name.
How can I push that changes from my local repo master to my branch at remote repo?
Once I pushed it to my branch at remote repo, I will inform my updation to my other team members.
How can they fetch and merge my updation located in my remote branch to their local master?
To push from your local master
to a different remote branch
, use:
git push origin master:branch
To have your friends pull this remote branch
into their local master
, they can use git pull
as:
git checkout master
git pull origin branch
You can specify the remote branch name in git push
command like this:
git push <remote> <local branch name>:<remote branch name>
So in your case, something like this:
git push origin master:smith-master
If you want to make this the default branch to push to, use the -u
flag in addition.
来源:https://stackoverflow.com/questions/40254420/git-push-local-master-to-remote-specific-branch