如何让 eclipse neon 在包视图中显示 git branch?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38841992/
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
How to make eclipse neon show git branch in package view?
提问by Ray Tayek
I just adding an existing project to GitHub using the command line.
Sometimes eclipse shows the branch in the package view like: foo [foo master]
.
有时蚀示出了像包视图分支:foo [foo master]
。
My eclipse project is a gradle/java project that was created before doing a: git init
and does not show the branch in the package view.
我的 eclipse 项目是一个 gradle/java 项目,它是在做 a: 之前创建的,git init
并且没有在包视图中显示分支。
Also, nothing is shown in the git repositories view.
此外,git 存储库视图中未显示任何内容。
How do I get eclipse to show me the branch in the package view?
如何让 eclipse 在包视图中向我显示分支?
回答by kivesic
The share option, as suggested by the previous answer, didn't work for me. However, Eclipse Preferences > General > Appearance > Label Decorations > check Git
did work. This made current brench visible in package view.
正如上一个答案所建议的那样,共享选项对我不起作用。但是,EclipsePreferences > General > Appearance > Label Decorations > check Git
确实有效。这使得当前 brench 在包视图中可见。
回答by VonC
If your imported project into Eclipse workspace is a git repo, you can Share your project with Git
如果您导入 Eclipse 工作区的项目是 git 存储库,您可以使用 Git 共享您的项目
If without creating a new repo, the act of selecting File > Team > Share Project
and then Git
should be enough for Eclipse to reconsider how it display your project in the Package Explorer (ie with git information on it)
如果没有创建新的存储库,选择File > Team > Share Project
然后的行为Git
应该足以让 Eclipse 重新考虑它如何在包资源管理器中显示您的项目(即带有 git 信息)
If this does not work, the alternate approach would be to:
如果这不起作用,替代方法是:
- switch to a new workspace
- import the project there,
- try and share it
- 切换到新工作区
- 在那里导入项目,
- 尝试分享
(which the OP Ray Tayekreports in the commentshaving done successfully)
(OP Ray Tayek在评论中报告说已成功完成)
回答by Alexander Pozdneev
My Eclipse Photon instance showed git decorations for some projects in the workspace and did not show the decorations for other projects in the same workspace.
我的 Eclipse Photon 实例显示了工作区中某些项目的 git 装饰,但没有显示同一工作区中其他项目的装饰。
It turned out that the projects without decorations were shallow copies (git clone --depth 1 <...>
).
原来没有装饰的项目都是浅拷贝(git clone --depth 1 <...>
)。
I resolved the issueby fetching some previous commits (git fetch --depth 2
).
我通过获取一些以前的提交 ( )解决了这个问题git fetch --depth 2
。