How do I push a local Git branch to master branch in the remote?

I have a branch called develop in my local repo, and I want to make sure that when I push it to origin it's merged with the origin/master. Currently, when I push it's added to a remote develop branch.

How can I do this?


$ git push origin develop:master

或者更普遍地说

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

As people mentioned in the comments you probably don't want to do that... The answer from mipadi is absolutely correct if you know what you're doing.

I would say:

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/26816.html

上一篇: 将DLL嵌入到已编译的可执行文件中

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