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

15,027

Solution 1

If your imported project into Eclipse workspace is a git repo, you can Share your project with 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)


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)

Solution 2

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.

Solution 3

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.

It turned out that the projects without decorations were shallow copies (git clone --depth 1 <...>).

I resolved the issue by fetching some previous commits (git fetch --depth 2).

Share:
15,027
Ray Tayek
Author by

Ray Tayek

programmer

Updated on June 19, 2022

Comments

  • Ray Tayek
    Ray Tayek almost 2 years

    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].

    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.

    Also, nothing is shown in the git repositories view.

    How do I get eclipse to show me the branch in the package view?