One of the great things about using an IDE for Java is the automated refactorings you get. The problem I'm having is that after using Refactor > Move to move a class into a different package (which moves the file itself in the filesystem), git status shows that the file in the old location has been deleted, and the one in the new location has been added.
The workaround I've found is clunky:
mv src/com/example/newpackage/Foo.java src/com/example/oldpackage/Foo.java git mv src/com/example/oldpackage/Foo.java src/com/example/newpackage/Foo.java Is there any way (when using the Git plugin for Eclipse) to have the refactoring do a git mv instead of a naive filesystem move?
git diff --cached -M. I've found that occasionally you have to tell git to detect a rename, in particular because it's detected afterwards.git diff --cached -M, and see the new location as a new file. What should I be looking for?git statusandgit diff --cached -Mwill report the change as a rename. If there are too many changes in the diff, add--name-statusand it'll just show the similarity index (in the form RXX, where XX is the percent similarity).git commit --dryruncommand they recommend there. Did thegit diff cached -Mreport the rename? If so, was the simularity index high? I did my testing with just a file move and a very small amount of change, the refactoring may have had many more changes which may have reduced it too much.