简体   繁体   English

如何在包视图中制作eclipse neon show git branch?

[英]How to make eclipse neon show git branch in package view?

I just adding an existing project to GitHub using the command line . 我只是使用命令行将现有项目添加到GitHub

Sometimes eclipse shows the branch in the package view like: foo [foo master] . 有时eclipse在包视图中显示分支,如: 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项目,它是在执行: 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在包视图中显示分支?

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. 但是,Eclipse Preferences > General > Appearance > Label Decorations > check Git确实有效。 This made current brench visible in package view. 这使得当前的brench在包视图中可见。

If your imported project into Eclipse workspace is a git repo, you can Share your project with Git 如果导入到Eclipse工作区的项目是git仓库,则可以使用Git共享项目

https://wiki.eclipse.org/images/a/ae/Egit-0.9-getstarted-share.png

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) 如果没有创建新的repo,选择File > Team > Share Project然后选择Git应该足以让Eclipse重新考虑它如何在Package Explorer中显示你的项目(即有关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 Tayek reports in the comments having done successfully) OP Ray Tayek 在评论中成功报道)

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 issue by fetching some previous commits ( git fetch --depth 2 ). 我通过获取一些先前的提交( git fetch --depth 2 )解决了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM