I did some refactoring and git rm
on old file and git add
on new files. It is showing up as a rename from old file to one of my new files:
renamed: src/P/Foo/PicturePosition.php -> src/P/Model/Block/Drawing/OffsettedPosition.php
even though I never did any git mv
and the files have different content. Why is this happening to me? Should I even try to fix it, and if yes, how?
I use git 1.9.1
Git doesn't record renames. It stores just the source trees and infers from the diffs which files were added, deleted, copied, renamed and/or edited.
git mv
is just syntactic sugar for a git rm
, mv
, then git add
, and is probably there to make Subversion users feel happier. There is no need to use git mv
to inform git that you have renamed a file.
My typical workflow is to just manipulate the files from my shell and editor, then do a git add -Av
to tell git to figure out for itself what changes I just made. I don't think I've ever used git mv
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With