Git分段文件存储在哪里? [英] Where Git staged files are stored?

查看:78
本文介绍了Git分段文件存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定,但这个问题突然出现在我的脑海里,并开始使用Google搜索。我发现了很多关于分段的细节,但未能找到git位置 staged 文件的位置。我的意思是说有一个文件或文件夹,git用来缓存对暂存文件和文件夹的引用?是的,它是哪个文件?

解决方案

临时发生在 .git / index .git / objects 。前者包含路径,后者包含文件内容。尽管这些都是二进制的。

 〜/ projects / bae / .git $ tree。 

├──HEAD
├──config
├──description
├──钩子
│├──applypatch-msg.sample
│ ├──commit-msg.sample
│├──post-update.sample
│├──pre-applypatch.sample
│├──pre-commit.sample
│├──pre-push.sample
│├──pre-rebase.sample
│├──prepare-commit-msg.sample
│└──update.sample
├──info
│└──不包括
├──物件
│├──info
│└──包
└──refs
├──团长
└──标签

8个目录,13个文件
〜/ projects / bae / .git $ cd ..
〜 / projects / bae $ touch test
〜/ projects / bae $ git add test
〜/ projects / bae $ cd .git
〜/ projects / bae / .git $ tree

├──HEAD
├──config
├──description
├──钩子
│├──applypatch-msg.sample
│ ├──commit-msg.sample
│├──post-update.sample
│├──pre-applypatch.sample
│├──pre-commit.sample
│├──pre-push.sample
│├──pre-rebase.sample
│├──prepare-commit-msg.sample
│└──update.sample
├──index < - NEW(包含路径)
├──info
│└──exclude
├──objects
│├──e6
││└──9de29bb2d1d6434b8b29ae775ad8c2e48c5391< - NEW(包含档案内容)
│├──info
│└──包装
└──refs
├──负责人
└──标签

9个目录,15个文件
〜/ projects / bae / .git $


I am not sure but this question popped up in my mind and started googling it. I found a lot of details about staging but failed to find where exactly git places staged files. I mean is there a file or folder that git uses to cache references to staged files and folders? Is yes which file it is?

解决方案

The staging happens inside .git/index and .git/objects. The former contains the paths and the latter contains the file content. Though these are all binary.

~/projects/bae/.git$ tree .
.
├── HEAD
├── config
├── description
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── prepare-commit-msg.sample
│   └── update.sample
├── info
│   └── exclude
├── objects
│   ├── info
│   └── pack
└── refs
    ├── heads
    └── tags

8 directories, 13 files
~/projects/bae/.git$ cd ..
~/projects/bae$ touch test
~/projects/bae$ git add test 
~/projects/bae$ cd .git
~/projects/bae/.git$ tree
.
├── HEAD
├── config
├── description
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── prepare-commit-msg.sample
│   └── update.sample
├── index                                           <-- NEW (contains paths)
├── info
│   └── exclude
├── objects
│   ├── e6
│   │   └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391  <-- NEW (contains file content)
│   ├── info
│   └── pack
└── refs
    ├── heads
    └── tags

9 directories, 15 files
~/projects/bae/.git$ 

这篇关于Git分段文件存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆