Current git branch not displayed in Eclipse package explorer - eclipse

I have checked the boxes "Git Repository Objects" and "Git Resources" in Preferences>General>Appearance>Label Decorations. Also in Preferences>Version Control (Team)>Git>Label Decorations>Text Decorations I have "{dirty:>} {name} [{repository }{branch}{ branch_status}]" under Projects.
Is there any other setting I need to set? This is in the original workspace where the project was created, in another Eclipse instance with a different workspace the branch is displayed as it should.

Related

Changing Team-> Remote-> Upstream URI in Eclipse

When I update the URI of remote Git repository for a project in the workspace, the other projects' URI is also being updated. Each project should have has its own Git repository.
For Eclipse a project is a folder on the filesystem that contains a .project resource (meta-file that describes the project, hidden by default in eclipse in the Java package explorer for example, but that can be seen in the Navigator view).
A git repository that is cloned on your file system has a root folder (in which you will find the .git folder). Your git repository probably contains several eclipse projects (in sub folders) that you have imported in your eclipse workspace.
Check your projects locations (project properties > project path) and you will see that they all reside in the same git tree.
If you change the upstream URI of your git repository, it applies to the whole repository. It cannot be applied only on a given sub folder of the tree.
So, when you right click on a project and change a Git setting (like the git URI), it applies on the whole Git repository. And as a consequence, it applies on all Eclipse projects that belong to the same git repository.
What is confusing I guess is that when you right click on a project to change its settings, you expect to change something that will only apply to that Eclipse project. This is true for most Eclipse preferences, but not for Git (because of what is explained above).

How to show current git branch in Eclipse toolbar

Is there a plugin or some setting in EGit to show the current git branch in the toolbar of eclipse so that it's visible on which branch you're working?
Like Sasikanth says there is no toolbar in EGit that shows the current branch.
Since there usually are multiple repositories within your IDE, a toolbar that shows the current branch of a single repository would probably often choose the wrong repository to display.
But if you have an idea how such a toolbar could work you may want to open an enhancement request.
In the meanwhile you can either use the Repositories View to see the current branch of each repsoitory or look at the Pakckage Explorer or Project Explorer. The projects are decorated with the repository they belong to and the current branch that is checked out.
Here the project belongs to the gitexample repository on branch master.

How do I rename my local git repository

I've renamed my remote repository and created a new local repository from it. How do I change it within EGit in Eclipse?
Previous answer list below also has issues. The only solution appears to be:
Backup .project, etc. files
Delete existing project
Import existing local git repository as a "general project"
Put backed up files into the new project
Restart Eclipse
Rename, per se, is not the actual operation -- changing repository is the correct mindset to solving the problem according to a coworker.
Select 'Team->Disconnect'
Select 'Team->Share' On 'Share Project' dialog
Select Git and click Next
Unselect 'Use or create repository in parent folder of project'
Select the new local repository
Checkbox the project name showing correct current location and target location
Click 'Finish'
Eclipse will move existing files from previous local repository to the new local repository.
I just renamed a repository. I use LiClipse, an Eclipse variant which includes EGit. I believe there is no way to do this operation with the EGit UI. Here's how I did it outside of EGit and Eclipse, without confusing them.
In the Git perspective, right-click on the repo, and select Remove repository from view... from the pop-up menu.
A dialogue box offers to delete the repository from the workspace. I interpreted this to mean, delete the repo directory and everything in it from my disk. Press the "No" button.
In the programming language-specific perspective (PyDev, in my case), right-click on the project, and select Delete... from the pop-up menu.
A confirmation dialogue box appears. In this case, I interpret it as just confirming that I want to remove the project's entry from the project list in that perspective. There is a checkbox, "Delete this project from workspace?". Leave that checkbox unchecked. Press the "Yes" button to confirm.
In the finder or command-line, find the repository directory, and change the directory name to the new name.
Return to Eclipse, and the Git perspective.
Select menu item, File... Open projects from file system.... (There is also a small icon with a "+", above the projects list, with tooltip "Add an existing local Git repository to this view". I believe it is different but equivalent.) A dialogue box appears.
Select the (renamed) repository directory. Click Next or Finish to complete the wizard. The Repository appears in the list of Git repositories in EGit.
Return to the programming language-specific perspective appropriate for that repository.
Select menu item, File... Open projects from file system.... A dialogue box appears.
Select the (renamed) repository directory. Click Next or Finish to complete the wizard. The Repository appears in the list of Git repositories in that language-specific perspective.
The project-specific Eclipse settings appear to be stashed away in a file .project within the repository, so they are not modified by the rename happening overhead.

how to hide yellow cylinder decorations on the right bottom corner of icons in project explore view?

i created a C++ project called us_txn_svc in eclipse kepler.
The workspace location is in /data/work/usfsi/, the project location in /data/work/usfsi/fsi_svc_us/us_txn_svc.
In project explore view, the proejct us_txn_svc is shown with a "remote" decoration on the icon and a suffix like " [fsi_svc_us echo]", echo is my user name on this computer. all files under this project are also shown with a "remote" decoration.
how to configurate my workspace to hide these useless infomation?
a snapshot:
The icon overlay decoration tells you the file is under version control, the information in [] gives you more version control information such as the repository.
You can usually turn all the decorations off by going to Preferences > General > Appearance > Label Decorations and unselecting your version control system (Git, SVN, CVS etc.)
You can fine tune the information shown for by version control in "Preferences > Team" ("Preferences > Version Control (Team)" in newer versions of Eclipse), select your version control system and look for Label Decorations.
Hey this should give you a good idea of this and more Eclipse Egit icons:
dirty (folder) - At least one file below the folder is dirty; that
means that it has changes in the working tree that are neither in the
index nor in the repository. tracked - The resource is known to the
Git repository. untracked - The resource is not known to the Git
repository.
ignored - The resource is ignored by the Git team
provider. Here only the preference settings under Team -> Ignored
Resources and the "derived" flag are relevant. The .gitignore file is
not taken into account.
dirty - The resource has changes in the
working tree that are neither in the index nor in the repository.
staged - The resource has changes which are added to the index. Not
that adding to the index is possible at the moment only on the commit
dialog on the context menu of a resource.
partially-staged - The resource has changes which are added to the index and additionally
changes in the working tree that are neither in the index nor in the
repository.
added - The resource is not yet tracked by but added to
the Git repository.
removed - The resource is staged for removal from
the Git repository.
conflict - A merge conflict exists for the file.
assume-valid - The resource has the "assume unchanged" flag. This
means that Git stops checking the working tree files for possible
modifications, so you need to manually unset the bit to tell Git when
you change the working tree file. This setting can be switched on
with the menu action Team->Assume unchanged (or on the command line
with git update-index--assume-unchanged).

Why are there different types of "Team" menus with EGit?

What dictates which type of team menu shows up for my project? Is there a way to switch between the two?
very traditional git-ish (ie. without "Synchorize Workspace" option)
eclipse team-ish (eg. with "Synchroize Workspace" option)
Update
My git repositories view shows the following:
Using the following steps I have enabled the "Team" features for my project:
delete project in Eclipse
delete project on filesystem (including .git/ repository data)
clone project into filesystem
add local repo to "Git Repositories" Eclipse view
in Eclipse, invoke an "Import Projects..." on the newly added repository, and "Import as general project"
The second menu should be in effect when you have:
Configured Upstream fetch
Configured Push to Upstream
That is when your local repo knows what to fetch from or push to your remote repo.