{"id":30837,"date":"2022-07-24T14:33:39","date_gmt":"2022-07-24T14:33:39","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=30837"},"modified":"2022-12-23T05:48:02","modified_gmt":"2022-12-23T05:48:02","slug":"git-tutorial-git-index","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/git-tutorial-git-index\/","title":{"rendered":"Git Tutorial: Git Index"},"content":{"rendered":"\n<p>The index is a binary file (generally kept in .git\/index) containing a sorted list of path names, each with permissions and the SHA1 of a blob object;\u00a0<a href=\"http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/git-ls-files.html\" target=\"_blank\" rel=\"noreferrer noopener\">git ls-files<\/a>\u00a0can show you the contents of the index:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">\n git ls-files --stage\n100644 63c918c667fa005ff12ad89437f2fdc80926e21c 0   .gitignore\n100644 5529b198e8d14decbe4ad99db3f7fb632de0439d 0   .mailmap\n100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0   COPYING\n100644 a37b2152bd26be2c2289e1f57a292534a51a93c7 0   Documentation\/.gitignore\n100644 fbefe9a45b00a54b58d94d06eca48b03d40a50e0 0   Documentation\/Makefile\n...\n100644 2511aef8d89ab52be5ec6a5e46236b4b6bcd07ea 0   xdiff\/xtypes.h\n100644 2ade97b2574a9f77e7ae4002a4e07a6a38e46d07 0   xdiff\/xutils.c\n100644 d5de8292e05e7c36c4b68857c1cf9855e3d2f70a 0   xdiff\/xutils.h<\/code><\/span><\/pre>\n\n\n<p>Note that in older documentation you may see the index called the &#8220;current directory cache&#8221; or just the &#8220;cache&#8221;. It has three important properties:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The index contains all the information necessary to generate a single (uniquely determined) tree object.<\/li><li>The index enables fast comparisons between the tree object it defines and the working tree.<\/li><li>It can efficiently represent information about merge conflicts between different tree objects, allowing each pathname to be associated with sufficient information about the trees involved that you can create a three-way merge between them.<\/li><\/ol>\n\n\n\n<p>The index is thus a sort of temporary staging area, which is filled with a tree which you are in the process of working on.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The index is a binary file (generally kept in .git\/index) containing a sorted list of path names, each with permissions and the SHA1 of a blob object;\u00a0git ls-files\u00a0can show you the contents of the index: Note that in older documentation you may see the index called the &#8220;current directory cache&#8221; or just the &#8220;cache&#8221;. It&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-30837","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=30837"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30837\/revisions"}],"predecessor-version":[{"id":30838,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30837\/revisions\/30838"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=30837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=30837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=30837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}