How can I push my changes to a remote branch

I am on a master branch 'master' and I have 1 commit ahead I want to create a new remote branch called 'new_remote' and push my commit there?

$ git branch
* master
$ git remote
old_remote

$ git status
# On branch master
# Your branch is ahead of 'old_remote/master' by 1 commit.

I want to push my commit to a new branch on remote called 'new remote' Thank you.


如果您当前正在使用本地分支主机,并且尚未创建新的远程分支:

git checkout -b new_branch     // creates a local branch (as a copy of the current)

git push origin new_branch // push it to the remote server

如果你想把你的master分支放到名为origin的远程仓库的newbranch上,那么你可以运行:

git push origin master:newbranch

git push origin localBranchName:master

更普遍,

git push remote local_branch_Name:remote_branch_name
链接地址: http://www.djcxy.com/p/25230.html

上一篇: 创建自定义UIView并在Swift中弹出显示

下一篇: 我如何将我的更改推送到远程分支