我如何将我的更改推送到远程分支

我在一个主分支'主'上,我有1个提交我要创建一个名为'new_remote'的新远程分支并在那里推我的提交?

$ git branch
* master
$ git remote
old_remote

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

我想推我的提交到一个名为'新远程'的远程新分支谢谢。


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

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

上一篇: How can I push my changes to a remote branch

下一篇: What's the difference between "git reset" and "git checkout"?