Git push local master to remote specific branch [duplicate]

血红的双手。 提交于 2019-12-08 06:09:06

问题


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?


回答1:


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



回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!