gitgit-diffdiffstat

what does "insertions and deletions" mean and how the numbers are calculated


when use diffStat or git diff to analyze the code,it often shows the result below,

71 files changed, 10938 insertions(+), 947 deletions(-), 3103 modifications(!), 3027 unchanged lines(=) but I do not know what the insertions and deletions mean?


Solution

  • You can see that message printed in diff.c#print_stat_summary()

    Those numbers are computed in diff.c#show_stats(), where the numbers of lines added or deleted are tallied.

    The actual computation for a given place is in diff.c#builtin_diffstat (which calls diff.c#diff_populate_filespec() if one of the files is a binary).