如何将本地Git分支推送到远程的主分支?

我在本地回购中有一个名为develop的分支,我想确保当我将其推到原点时,它会与原点/主点合并。 目前,当我将它添加到远程开发分支时。

我怎样才能做到这一点?


$ git push origin develop:master

或者更普遍地说

$ git push <remote> <local branch name>:<remote branch to push into>

正如人们在评论中提到的,你可能不想这样做......如果你知道自己在做什么,那么来自mipadi的答案是绝对正确的。

我会说:

git checkout master
git pull               # to update the state to the latest remote master state
git merge develop      # to bring changes to local master from your develop branch
git push origin master # push current HEAD to remote master branch

链接地址: http://www.djcxy.com/p/26815.html

上一篇: How do I push a local Git branch to master branch in the remote?

下一篇: How do you push just a single Git branch (and no other branches)?