如何让 IntelliJ 查看我的远程 git 分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18368237/
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-10 16:48:55  来源:igfitidea点击:

How do I get IntelliJ to see my remote git branches

gitintellij-idea

提问by Zipper

I'm using BitBucket and I created a branch on another machine with IntelliJ and pushed it in to my repo. I can see the branch on the BitBucket site, but when I try to access the remote branch using IntelliJ on another machine I can't see the new branch when I go to VCS -> git -> Remote Branches. I tried doing a pull, but that only brought down the head changes (which currently points to master), and didn't update the remote branches list. Is there something you have to do to see the remote branches (besides Head and Master) in IntelliJ?

我正在使用 BitBucket,我在另一台机器上用 IntelliJ 创建了一个分支并将它推送到我的仓库中。我可以在 BitBucket 站点上看到分支,但是当我尝试在另一台机器上使用 IntelliJ 访问远程分支时,当我转到VCS -> git -> Remote Branches. 我尝试进行拉动,但这只会降低头部更改(当前指向 master),并且没有更新远程分支列表。要在 IntelliJ 中看到远程分支(除了 Head 和 Master),您需要做些什么吗?

回答by Zipper

In case anyone runs in to something similar I found that on my IntelliJ at least I had to run a fetchand then I could see the remote branches. It didn't appear that a pull was sufficient even though pull is supposed to fetch.

如果有人遇到类似的情况,我发现至少在我的 IntelliJ 上我必须运行一个fetch然后我可以看到远程分支。即使 pull 应该是 fetch ,似乎 pull 也不够。

回答by Lowell

I found the same thing with IntelliJ, also fetch not only gets all remote branches for the current repository in your project, but it also gets them for all repositories in the project.

我在 IntelliJ 中发现了同样的事情, fetch 不仅获取项目中当前存储库的所有远程分支,而且还获取项目中所有存储库的它们。

It is safe to say that a pull only fetches for the current repository and branch that you are on, and fetch fetches for all repositories in the project.

可以肯定地说,pull 只提取您所在的当前存储库和分支,并提取项目中的所有存储库。

(I would have simply commented on Zipper's excellent answer, but I seem to only have one reputation point :-()

(我会简单地评论 Zipper 的出色回答,但我似乎只有一个声誉点:-()

回答by SummerEla

In case anyone came here for this issue in PyCharm (by same creators), I added new branches after I had already cloned the repo into PyCharm. Fetch, from either the command line or within the GUI, would not pickup the new branches even after I tried several times and restarted the program.

如果有人在 PyCharm 中(由相同的创建者)为了这个问题来到这里,我在将 repo 克隆到 PyCharm 之后添加了新的分支。即使在我多次尝试并重新启动程序之后,从命令行或 GUI 中获取也不会拾取新分支。

I ended up deleting the repo, re-cloning, and was then able to find and checkout the branches I needed.

我最终删除了 repo,重新克隆,然后能够找到并签出我需要的分支。