Why staging directory is also called Index/Git Index? -



Why staging directory is also called Index/Git Index? -

i confused naming of staging directory (git index) in git.

is there special meaning such called index? why not called cache / or temp directory can understand more easily?

to me, index sth help search things faster, indexing in dbms, how relate staging area???

i did google search still have no much idea. ref link git index

the article main git maintainer junio c. hamano, instructive, grasping difference between cache , index: (emphasis mine)

when linus started writing git, aim allow him reproduce each , every intermediate state produced original "tarball , patches" workflow used before bitkeeper days. starting 2.6.12 tarball, queues patch-1, patch-2,... 2.6.12 itself, 2.6.12 patch-1 applied, 2.6.12 both patch-1 , patch-2 applied, become 3 versions.

but won't scale if have shuffle hundreds of patches day. invented "directory cache"; concept, corresponds "tree" objects in today's git: collection of records, each of compact representation of whole directory construction contains. way build "add contents cache, or update contents in cache".

the command directory host collection of such version command records named ".dircache" (this renamed ".git" after time). there file called ".dircache/index", , contents of file read , manipulated in set of variables in c named after noun, "cache". then, the concept of today phone call index, buffer area build collection of contents intend write out tree object, called "cache". talked "cache" , "index" interchangeably, file records in "cache" named "index". (and still is) index allow find contents in cache giving pathname.

as more , more people started using git without having read code @ all, utilize of word "index" has become more prevalent obvious reasons. on filesystem, much more visible variable name in c source code. eventually, stopped using "cache" noun name phone call "the index" today when explaining utilize of git end-user. the word "cache" still used noun when want talk internal info construction in context of discussing git implementation (e.g. "let's create possible programs work more 1 cache @ same time").

at end user level, "cache" used adjective these days; "cached", meaning "contents cached in index, not contents in work tree". have called "indexed", "cached contents" established phrase days mean exact concept, , did not need word meant same thing.

[...] in before days, there distinction between "adding new file index" , "updating file in index new contents". [...] modern (and medieval) versions of git uses "git add" both. have been honest , called deed of updating-or-adding-to-the-index "add", people in "git training" industry started teaching index "the staging area next commit", , inevitable consequence, verb "to stage" started appear in many documentation mean "the deed of adding contents index". utilize verb myself, when suspect audience might have learned git first these new people. strictly speaking redundant , recent word in git vocabulary.

git git-index

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -