How to change delete + add to move in git history

I have a git repository that is a mixture of some old svn repos. when I mixed everything that I did not understand to make git mv and not just move files, so now the svn history for most files will be lost. is there any way to fix it?

the old structure was something like:

svn1 |_apps/ |_tests/ |_... svn2 |_src |_libs svn3 |_src |_libs 

and now:

  root |_libs | |_svn1_name | | |_apps | | |_tests | | |_... |_addons | | |_svn2_name | | | |_src | | | |_libs | | |_svn3_name | | | |_src | | | |_libs 

I tried to check the previous commit on this mv by running git mv, creating a new branch and reinstalling the wizard, but the structure is complex and merging is a pain. is there an easier way to do this?

+2
source share
2 answers

Normally, Git does not track rename other than delete and add. When this happens within the same commit, Git can quickly conclude that the rename has been done and map the rename to git log accordingly. However, if deleting and adding the same file occurs in different commits, you need to use the --find-copies-harder git log switch

- finding photocopies is harder

For performance reasons, by default, the -C option finds copies only if the original copy file was modified in the same change set. This flag allows the team to check unmodified files as candidates for the source of the copy. This is a very expensive operation for large projects, so use it with caution. Providing more than one -C option has the same effect.

+4
source

using git log --follow in one file, I can track its history beyond the renames that were committed as add + remove

0
source

Source: https://habr.com/ru/post/1500514/


All Articles