git index - How many versions of a file are kept in git when that file is modified? -
so reading version control git, 2nd edition , stumbled on paragraph (page 51, section "using git add")
most of day-to-day changes within repository simple edits. after edit , before commit changes, run
git add
update index absolute latest , greatest version of file. if don’t, you’ll have 2 different versions of file: 1 captured in object store , referenced index, , other in working directory.
what confuses me bolded sentence. let's opposite, change 1 file , run git add
on , file staged. well, seems me again have 2 different version of file: 1 captured in object store , other in working directory , referenced index. difference index references file in working directory rather 1 in repo.
am missing insight here author wanted emphasize? how many different versions of file can exist in "git"? "git" not clear suppose means on working directory + object store + index.
the critical concept being conveyed 1 understand: git add
step necessary prevent working tree , index differing each other.
"two different versions" not intended mean only 2 versions can exist; rather emphasizes content in working tree otherwise not included in index, concept folks new git fail grasp.
Comments
Post a Comment