1

I'm trying to integrate Maven into an existing project. Using IntelliJ IDEA, I've tried the following steps:

Right click on project -> Add Frameworks Support... -> Checking Maven and pressing OK

The above works great; except that it drastically alters (read: copy -> delete -> paste) the project structure. The change is fine - except that GIT believes that all files have been deleted and re-created (without history) in another folder.

How to integrate a project with Maven without losing the GIT history?

Rob Parker
  • 503
  • 4
  • 10
Zar
  • 6,786
  • 8
  • 54
  • 76
  • 1
    If you `git rm ` and `git add ` does `git status` show the summary for the staged file changes as separate delete and create or one single modify? – indivisible Mar 01 '14 at 23:14
  • @mbs They are listed as separate delete and create. I tried "git rm src/*" and then doing git add src/main/*", which doesn't solve the problem. All history is still gone. – Zar Mar 01 '14 at 23:40
  • What is the diff between the old and new versions of the files? Can you supply a short example based off one file? `git diff HEAD` or `git diff --cached` when the changes are staged (can't remember off the top of my head which you should do). – indivisible Mar 01 '14 at 23:43
  • @mbs After I've done the git rm/add or before? Many thanks for helping, by the way! – Zar Mar 02 '14 at 00:05
  • After. You don't need to commit the changes – indivisible Mar 02 '14 at 00:08
  • @mbs When re-doing the steps again to retrieve the diff output (git rm src/com/* ; git add src/*), git started to notice the file similarities and outputted RENAME instead of add/delete. Now, when using git log --follow instead of gitk, everything works perfect! Many thanks for your time and help! – Zar Mar 02 '14 at 00:35

1 Answers1

0

With git there is no difference between

copy -> delete -> paste

and simple

move

or even

git mv

which is equivalent to

copy -> delete -> paste
git add --all .

The problem might be in your diff tool. What are you using to view the diff?

Try

git add --all .

and commit and see what happens.

Also see

What's the purpose of git-mv?

Community
  • 1
  • 1
František Hartman
  • 14,436
  • 2
  • 40
  • 60