Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EGit refactor rename project NOT renames git working tree folder

Tags:

git

eclipse

egit

If I do refactor rename (Alt + Shift + R) a project (which updates the references along with the resource name change) in Eclipse which was shared in git repository, then the .project file will be changed and shown in Git Staging view.

But project folder was not renamed in the git working directory, so the project name in Package/Navigator view shown is different than in the git working directory.

Is it a bug in EGit? Or are there any ways to do automatically change the folder name in git working directory, so that I can commit these changes.

Note that renaming other folders/files is working fine.

like image 324
Chandrayya G K Avatar asked Jan 09 '23 15:01

Chandrayya G K


2 Answers

Just use Refactor -> Move after right click on the project. You can also use (Alt + Shift + V). Seems to manage git all right.

enter image description here

like image 167
borjab Avatar answered Jan 12 '23 05:01

borjab


This behavior is unrelated to Git or EGit. In Eclipse, a workspace project is not represented through the file system folder it is located in. It is the .project file that describes the project.

While usually a project is located in a folder of the same name this isn't required. For example a project named bar could be located in folder foo

/path/to/foo/.project

Contents of .project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>bar</name>
  ...
</projectDescription>

The Rename Project command does not touch the folder in which the project is located. The command only changes the name of the project as it appears in the .project file.

Consequentially, EGit will show the .project file as changed but nothing else. As borjab suggests, youd can use the Move (Alt+Shift V) command to change the location of a project.

like image 33
Rüdiger Herrmann Avatar answered Jan 12 '23 04:01

Rüdiger Herrmann