What does it mean when Git says 'rewrite' or 'rename' in a commit message?

后端 未结 1 1952
囚心锁ツ
囚心锁ツ 2020-12-09 01:30

Running a git commit leads to the following output:

[manu@host] git: git commit -a -m \"StreamIt instrumentation\"
[master 263410f] StreamIt ins         


        
相关标签:
1条回答
  • 2020-12-09 01:54

    Git uses heuristics to determine if a change was a renaming or copying of a file, and also if it is a "rewriting" of the file. Roughly speaking, if the diff between the old and new version is bigger than the new version itself, it's a "rewrite".

    This is tuned for git's original use case of changing source files, most often making localised changes: since it is based on a line-by-line diff, things like reindenting a source file can trigger it. Also, since it is determined on-the-fly, diff options like "-b" and "-w" can change the evaluation of whether a change is a rewrite (or a copy, or a rename).

    The percentage is git's "dissimilarity index" (as opposed to the percentage "similarity index" for a rename or copy). Probably something like the percentage of lines in the file that have changed.

    0 讨论(0)
提交回复
热议问题