Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Renaming Eclipse project didn't rename folder in local git repo
Renaming Eclipse project didn't rename folder in local git repo [message #1185172] Wed, 13 November 2013 23:32 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I have a Maven project that I shared with a git repo. At one point I decided I needed to rename the project and artifact. I renamed it in Eclipse and it looked fine. The project name changed, and it changed the artifact name. However, it didn't change the folder in my local git repo. I couldn't do a "commit" because it didn't think there were any changes to commit.

I finally resorted to semi-manual surgery on the local git repo, by doing "git mv oldname newname". This fixed the name in my local git repo and gave me changes to commit, but this now messed up my Eclipse project. At this point, I just deleted the project (not the contents) and reimported projects from the repo, which recreated the project with the correct name.

Is there a better way I could have done this?
Re: Renaming Eclipse project didn't rename folder in local git repo [message #1185640 is a reply to message #1185172] Thu, 14 November 2013 07:02 Go to previous messageGo to next message
na na is currently offline na naFriend
Messages: 11
Registered: November 2013
Junior Member
David M. Karr wrote on Wed, 13 November 2013 18:32
I have a Maven project that I shared with a git repo. At one point I decided I needed to rename the project and artifact. I renamed it in Eclipse and it looked fine. The project name changed, and it changed the artifact name. However, it didn't change the folder in my local git repo. [...]


IMHO thats not an EGit issue, if you create a project outside the workspace (which is recommended for Git) and rename it within Eclipse it won't rename the system folder. Also the project name is independent from the project folder itself. It's just a name in a configuration file (.project for Eclipse). But I understand that it can be confusing ending up with a name different from the folder containing all the source files. So, renaming at Eclipse level, soft deleting the project(remove w/o deletion), renaming the folder at the system level and finally reimport it into Eclipse seems to be your best option.


[Updated on: Thu, 14 November 2013 07:02]

Report message to a moderator

Re: Renaming Eclipse project didn't rename folder in local git repo [message #1188633 is a reply to message #1185640] Fri, 15 November 2013 18:46 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I'd say that anything that makes a tool harder to use is an issue with that tool, whether or not it's possible to change it. If you implement a git interface in Eclipse, the goal should be to allow users to do everything they need to do in Eclipse, without having to go to an external shell or do "surgery" on their files to get things to work.

If I import projects from a git repo, then there's an assumption that the project name is the same as the folder name in the git repo. I can see the possibility that someone might want to have more control over that (allowing different names), but I would assume that in most cases the names should stay equal. If I change the Eclipse project name, I think it's very likely that someone's going to want to change the git repo folder name, so the tool should make this the default, or make it easy to do from Eclipse.
Re: Renaming Eclipse project didn't rename folder in local git repo [message #1189911 is a reply to message #1188633] Sat, 16 November 2013 09:44 Go to previous messageGo to next message
na na is currently offline na naFriend
Messages: 11
Registered: November 2013
Junior Member
While I understand your arguments, it is a "problem" related to Eclipse. It is Eclipse that works that way. And as a plugin developer you certainly don't want to mess with some internals from the host platform. So the logical consequence would be to file a ticket for Eclipse, but I'm pretty sure they will tell you that the behaviour which annoys you works as designed. Smile

[Updated on: Sat, 16 November 2013 09:45]

Report message to a moderator

Re: Renaming Eclipse project didn't rename folder in local git repo [message #1191992 is a reply to message #1185172] Sun, 17 November 2013 10:07 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
David M. Karr skrev 2013-11-14 00.32:
> I have a Maven project that I shared with a git repo. At one point I decided I needed to rename the project and artifact. I renamed it in Eclipse and it looked fine. The
> project name changed, and it changed the artifact name. However, it didn't change the folder in my local git repo. I couldn't do a "commit" because it didn't think there
> were any changes to commit.
>
> I finally resorted to semi-manual surgery on the local git repo, by doing "git mv oldname newname". This fixed the name in my local git repo and gave me changes to commit,
> but this now messed up my Eclipse project. At this point, I just deleted the project (not the contents) and reimported projects from the repo, which recreated the project
> with the correct name.
>
> Is there a better way I could have done this?

Use Refactor > Move to move the project to a new path.

-- robin
Re: Renaming Eclipse project didn't rename folder in local git repo [message #1456552 is a reply to message #1191992] Thu, 30 October 2014 13:30 Go to previous messageGo to next message
naresh kumar is currently offline naresh kumarFriend
Messages: 1
Registered: October 2014
Junior Member
Hi David,

Can you please explain me how to refactor eclipse project. I had done it through eclipse, but the pom.xml isn't changing.
Can you please tell me in detail the steps involved in this process.
Re: Renaming Eclipse project didn't rename folder in local git repo [message #1457962 is a reply to message #1456552] Fri, 31 October 2014 22:33 Go to previous message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
naresh kumar skrev 2014-10-30 15.47:
> Hi David,
> Can you please explain me how to refactor eclipse project. I had done it through eclipse, but the pom.xml isn't changing. Can you please tell me in detail the steps
> involved in this process.

Eclipse doesn't understand maven pom files. You have to edit those manually.

-- robin
Previous Topic:Synchronize Bitbucket with Eclipse
Next Topic:Push/Fetch
Goto Forum:
  


Current Time: Fri Mar 29 10:12:18 GMT 2024

Powered by FUDForum. Page generated in 0.02507 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top