git推送到远程分支 [英] git push to remote branch

查看:142
本文介绍了git推送到远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,



我克隆了一个回购协议。我创建了一个分支,通过发出以下命令来处理一个功能:

git branch fix78



然后我在那个分支上工作

git checkout fix78



我继续向这个本地分支提交。现在我想把它推到repo上,因此我发出了下面的命令:
$ b

git push origin master:fix78



我从网络浏览器中查看了回购,发现在回购库上创建了一个名为fix78的新分支。但它没有我提交的任何提交。



我在这里做错了什么?这是我想实现的:

有一个回购(主人(SVN术语中的主干)),现在当我正在研究我想要的功能时创建它的一个本地分支,然后我也想检查这个分支到回购(这样其他团队成员可以看到我在做什么),然后我希望我的本地分支与这个远程分支同步,我创建。



任何帮助/反馈都会非常棒。



谢谢。

解决方案> 远程分支称为fix78。您想推送本地分支fix78,它具有相同的语法,但没有 master:



您可以修复它通过执行 git push origin:fix78 来删除远程分支,然后执行 git push origin fix78 来推送本地分支到远程回购。


Folks,

I had cloned a repo. I created a branch out of it to work on a feature by issuing the following command:

git branch fix78

then I worked on that branch by

git checkout fix78

I continued to make commits to this local branch. Now I wanted to push this to the repo and hence I issued the following command:

git push origin master:fix78

I viewed the repo from a web browser and saw that a new branch called fix78 was created on the repo. But it did not have any of my commits that I had made.

What am I doing wrong here? This is what I am trying to achieve:

There is a repo(master(trunk in the SVN lingo)), now when I am working on a feature I want to create a local branch of it and then I also want to check in this branch to the repo(so that other team members can see what I am working on), then I want my local branch to be in sync with this remote branch that I create.

Any help/feedback would be totally awesome.

Thanks.

解决方案

git push origin master:fix78 pushes the local master to a remote branch called fix78. You wanted to push the local branch fix78, which has the same syntax but without the master:

You can fix it by doing git push origin :fix78 to delete the remote branch and then git push origin fix78 to push your local branch to the remote repo.

这篇关于git推送到远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆