git diff - Does git similarity index 75% mean git thinks I have renamed a file? -


i using gitextensions visual studio , when go commit change, says have added 2 new files , has third file (a .resx file) seems comparing .resx file , says have similarity index 75%

the files not related, large portion of file standard template in .resx files can understand them being treated similar.

so question - message mean git thinks have renamed older file , mess if continue commit is?

git not store diffs.1 instead, each commit stores complete files (as listed in index-at-the-time-the-commit-is-made), sort of stand-alone entity. retrieve previous commit, git finds commit id , extracts associated files.2

the "similarity index" , presentation of "a file renamed" or "a file copied" git guessing at happened, in attempt make things clearer human, or present shortest way 1 commit another, instance. correct template match misleading git @ point, "this point" "presentation user of how point point b", not "what or stored".

the git status command—presumably visual studio, i've never used, runs git status you—makes git produce new comparison, time "most recent/current commit" (head) vs "current index", i.e., "what committed if commit now". in fact, two comparisons: head-vs-index, , index-vs-work-tree. gets git's best guess @ happened—including computing similarity index, can guess whether file(s) renamed.

note once have 2 given commits git diff, can specify different copy and/or rename thresholds "what happened" shown in different ways. git on demand, extracting (mostly in-memory) 2 commits, comparing them, computing each similarity index (again) @ time, , making best guess @ copies or renames there.


1this glosses on git's "pack" files, do use deltas. however, pack files constructed long after commit (or series of commits). new commits make new, stand-alone object files, may packed , re-packed in various ways later.

2to speed operation, git will use current index (cache) information figure out quick way change "commit checked out" (as noted index/cache) "new commit checked out" (given argument git checkout). in particular, long have not modified work-tree index current, allows git checkout avoid touching or inspecting files when switching between similar branches or commits.

you don't need worry either of these footnotes, though: it's handled automatically, behind scenes. (footnote 2 can come play when start using --work-tree= arguments, people in fancy auto-deployment scripts bare repositories on servers. however, there works, automatically.)


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -