将本地分支推送到 GitHub
我配置了 Git,以便当我运行 git push 时,它将更改推送到我的 GitHub 存储库。到目前为止我只有一个主分支。
但是,我现在已经创建了一个本地分支并使用以下方式提交:
git checkout -b my_new_branch
git commit
我现在想做的是将我在此分支上的更改推送到 GitHub。我只做 git Push 吗?
当我第一次设置它时,我确实运行了:
git config push.default current
I have Git configured so that when I run git push
, it pushes changes to my GitHub repo. Until now I have only had a master branch.
However, I have now created a local branch and committed to it using:
git checkout -b my_new_branch
git commit
What I would like to do now is push my changes on this branch to GitHub. Do I just do a git push?
When I first set it up I did run:
git config push.default current
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信您正在寻找 git push origin my_new_branch ,假设您的 origin 远程配置已配置为访问您的 github 存储库。
I believe you're looking for
git push origin my_new_branch
, assuming your origin remote is configured to hit your github repository.根据您本地的 git 设置,如果您签出的分支不是您克隆的分支,也不是您尝试推送的分支,则 git 将不会推送您的本地分支。
这是它提供的消息:
Depending on your local git settings, if you have a branch checked out that isn't the one you cloned or one that exists where you are trying to push, git will not push your local branch.
Here is the message it provides:
如果你真的很懒,你可以push所有本地分支 通过简单地使用
If you are really lazy, you can push all local branches by simply using
如果您已将 git 配置为推送到 GitHub 主存储库,则无论您在哪个分支,它都会推送到您的 GitHub 主存储库。
请记住,如果许多开发人员在同一个存储库中工作,则可能会发生冲突。
If you've configured your git to push to your GitHub master repo, no matter in with branch you are, it will push to your GitHub master repo.
Bear in mind that, if many developers are working in the same repository, you could get a conflict.