Search code examples
gitbatch-renamesmartgit

Git does not detect large rename operation


I make a sort of rebranding and rename all root folders inside the project. Smartgit sees all files as missing and untracked. When I commit some of them are marked as renamed in log but a lot of them not. I don't want to lose the connection with fork source for these files. I don't change anything inside the files, just rename all root folders and some files inside.

I perform rename via Total Commander mass rename functionallity. It would take a long time to rename those manually with git mv.

What can I do to help git to detect the renames?

UPDATE

I found out that it detects renaming only on recently added files which did not exist in the fork source.

UPDATE2

I created 2 clones to test this behavior.

  1. Changed one file, commit and push in clone 1.
  2. Performed rename in clone 2, commit, pull.

And now I have a rebase conflict in clone 2. Seems like it actually detects rename but why then conflict?

enter image description here


Solution

  • Git does not track renames at commit time[1], but always calculates them on the fly. Hence, there is nothing you can do about it. See also:

    https://stackoverflow.com/a/7941544/241453

    [1] https://git.wiki.kernel.org/index.php/Git_FAQ#Why_does_Git_not_.22track.22_renames.3F