如何让新分支显示在 Eclipse Git Remote Tracking 中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47390703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:59:20  来源:igfitidea点击:

How do I get a new branch to show up in Eclipse Git Remote Tracking?

eclipsegitegit

提问by jumps4fun

I have an existing Eclipse git project, with a master and development branch present in both local, and remote tracking. I have just added a new branch in my git repository, but I can't figure out how to get it to show up in Eclipse.

我有一个现有的 Eclipse git 项目,在本地和远程跟踪中都有一个 master 和 development 分支。我刚刚在我的 git 存储库中添加了一个新分支,但我不知道如何让它显示在 Eclipse 中。

I have tried to read up on the subject, but it seems like it is just expected to automatically show up. I have found a lot of similar questions, but they all seem to deal with the issues of a completely empty remote tracking folder, instead of my problem of only a single new branch missing. I already have Master and Develop present.

我曾尝试阅读该主题,但似乎只是希望它会自动出现。我发现了很多类似的问题,但它们似乎都在处理一个完全空的远程跟踪文件夹的问题,而不是我只缺少一个新分支的问题。我已经有 Master 和 Develop 了。

Here is what does not work:

这是不起作用的:

  • Clicking refresh in the Git repositories window.
  • Any kind of synchronize, pull or other update I can find
  • 在 Git 存储库窗口中单击刷新。
  • 我能找到的任何类型的同步、拉取或其他更新

Here is what would work:

这是可行的:

  • Right clicking the remote tracking folder, and selecting "Paste repository path or URI". If I do that, and select the exact same path as is already there, I can see my new branch. This action does require that I completely clone the whole repository to an empty folder again, and that can't be how this is intended to work.
  • I believe it might work to use some kind of command line tool, but I really want an Eclipse solution to this, as I feel sure it exists, and I am just missing something.
  • 右键单击远程跟踪文件夹,然后选择“粘贴存储库路径或 URI”。如果我这样做,并选择与现有路径完全相同的路径,我可以看到我的新分支。此操作确实需要我再次将整个存储库完全克隆到一个空文件夹中,这不可能是它的工作方式。
  • 我相信使用某种命令行工具可能会起作用,但我真的想要一个 Eclipse 解决方案,因为我确信它存在,而我只是遗漏了一些东西。

回答by howlger

In the Git Repositoriesview:

Git 存储库视图中:

  1. Right-click the repositoryand choose Fetch from Upstream
  2. If the new branch will not shown up below Branches/Remote Tracking, you have to configure fetch:
    1. Right-click the fetch node below Remotes/originand choose Configure Fetch...
    2. In the Configure Fetchmake sure there is only the single Ref mapping+refs/heads/*:refs/remotes/origin/*:
      Configure fetch
  1. 右键单击存储库并选择从上游获取
  2. 如果新分支不会显示在Branches/Remote Tracking下方,则必须配置 fetch:
    1. 右键单击Remotes/origin下面的 fetch 节点,然后选择Configure Fetch...
    2. Configure Fetch 中,确保只有一个Ref 映射+refs/heads/*:refs/remotes/origin/*
      配置获取

回答by Hongtao Chen

What I did: 1: disconnected. 2. refresh and pull. Then, it shows the new branch 3. create local and pull.

我做了什么: 1:断开连接。2.刷新和拉取。然后,它显示了新的分支 3. create local 和 pull。