0

I'm trying to Mavenize my project... the problem I'm facing is that my java files are in ProjectFolder\src but I need to move them to ProjectFolder\src\main\java

I am unsure how to proceed, as I have a few commits to git that I don't want to lose but I don't know how to go ahead and inform git about the move... I mean how will git know the moved file is the same file as before?

Should I:

  • just unmark the src folder as Source Root, move the folder with windows explorer and then remark it as Source Root?
  • or Refactor | move the src folder ?
  • or something else?
ycomp
  • 8,316
  • 19
  • 57
  • 95
  • this is not a duplicate, the link does shed some light on the matter. My main problem is I'm trying to do this via IDEA, and now the files are all displayed as deleted and also as "unversioned files" - that I need to add back in - I'm not sure git is really that intelligent if I commit all those unversioned it will know it is the old versioned files? – ycomp Sep 19 '15 at 15:26
  • Click on the duplicate question, and read: it explains that git doesn't move files. It deletes them and recreates them elsewhere. Which is precisely what's happening in your scenario: the moved files are marked as deleted in their old location, and as untracked in the new one, which is expected. `git add` the new untracked files and commit. – JB Nizet Sep 19 '15 at 15:40
  • thanks, I see what you're saying.. git will handle it fine (according to git) but IDEA can't handle it .. I tried it but I guess it doesn't matter.. I still have the old commits if I need to restore, just diff doesn't have any history anymore but that's something I can live with. I guess I could just manually choose the 2 files if I need to diff them for some reason. – ycomp Sep 19 '15 at 15:50

0 Answers0