我可以在本地存储库中看到两个远程分支:
$ git branch -a
remote/origin/master
remote/origin/feature1实际上,我的远程存储库中有四个分支。我当地的第三或第四分店怎么办理退房手续?
我通过搜索网络尝试了很多命令,但没有一条对我有用。不过,从远程到本地获得主分支和feature1分支的更新并没有问题。
发布于 2019-05-02 18:58:03
这是:
远程“原产地”url = fetch = +refs/heads/feature1:refs/remotes/origin/feature1 fetch =+url/heads/master:url/remotes/remotes/master
是问题的根源。在这里,您已经指示您的Git,无论在origin上的Git中存在什么分支,您都希望您的Git只获取并记住feature1和master,您将称之为origin/feature1和origin/master。
如果不更改fetch,则origin的默认标准设置是:
fetch = +refs/heads/*:refs/remotes/origin/*如果你有这个设置,一切都会自动工作。
(接下来的问题是:当您似乎希望使用标准默认设置提供的行为时,为什么停止使用标准默认设置?编辑:--显然答案是:您没有使用,Eclipse/ EGit提供了。)
发布于 2019-05-02 16:50:15
您的本地存储库在原产地方面可能已过时。要追上,就跑
git fetch现在你应该看看其他的树枝。如果其中一个分支名为feature2,则运行
git checkout -b feature2 origin/feature2或者,用最近的git,简单地说
git checkout feature2将签出分支并设置跟踪,以防您与其他开发人员合作。
发布于 2019-05-02 17:44:29
好的,我的本地git的配置文件中有以下内容
[remote "origin"]
url = <url>
fetch = +refs/heads/feature1:refs/remotes/origin/feature1
fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "feature1"]
remote = origin
merge = refs/heads/feature1
rebase = false将远程分支feature2添加到[remote "origin"]部分后,
[remote "origin"]
url = <url>
fetch = +refs/heads/feature1:refs/remotes/origin/feature1
fetch = +refs/heads/master:refs/remotes/origin/master
fetch = +refs/heads/feature2:refs/remotes/origin/feature2那就跑
git fetch --all
git branch -a我在输出中看到了远程feature2分支。我现在可以结账了,feature2。
还有一个问题,我应该如何将本地git的分支信息与远程回购同步,而不必手动修改config文件?
https://stackoverflow.com/questions/55956881
复制相似问题