git - Print percentage of dissimilarity -


sometimes when drastically change file, triggers rewrite:

yes | head -256 > pa.txt git add . git commit -m qu truncate -s128 pa.txt yes n | head -64 >> pa.txt git commit -am ro 

result:

[master 79b5658] ro  1 file changed, 128 insertions(+), 256 deletions(-)  rewrite pa.txt (75%) 

however not happen smaller changes:

yes | head -128 > pa.txt git add . git commit -m qu truncate -s64 pa.txt yes n | head -32 >> pa.txt git commit -am ro 

result:

[master 88ef937] ro  1 file changed, 32 insertions(+), 96 deletions(-) 

can run command show percent change regardless of amount? looked git diff-tree, again seems show when change drastic.

git diff -u10000 | awk ' /^i/ {getline; next} /^-/ {pa += length} /^ / {qu += length} end {printf "%.0f%\n", pa/(pa+qu)*100} ' 
  1. force full context -u10000

  2. filter out --- lines

  3. filter in deletions , context lines

  4. count bytes each


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -