Converting file (tracked with Git) from Java to Kotlin in Android Studio

前端 未结 4 2253
梦毁少年i
梦毁少年i 2021-02-12 04:50

A conversion from Java to Kotlin in Android Studio 2.3.2 (in 3.0 the same behaviour) creates a new file and deletes previous. So Git doesn\'t know anything about this conversion

4条回答
  •  無奈伤痛
    2021-02-12 05:29

    As mentioned in the other answers, git tracks the contents of the file, not its renames. When git log is run with --follow option, it shows history beyond renames, however it considers a file to be renamed only if the previous and current file contents have a similarity index of 50% or more, i.e. less than half the lines of the file have changed.

    For this case, where most of the lines have changed, you may set a lower bar for the similarity index using the -M option:

    git log -M20% --follow -- /path/to/file
    

    Depending on the case, you may need to go even lower than 20%.

提交回复
热议问题