什么是GIT存储库的工作目录? [英] What is the Working Directory of a GIT repository?

查看:151
本文介绍了什么是GIT存储库的工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我迄今阅读GIT的经验,我发现工作目录似乎有点超载。有时,人们指分支签出的硬盘上的目录,例如当克隆repo时,分支被检入到repo新克隆的目录中。



但是有时候人们只是指一个包含 untracked的抽象位置文件修改过的文件即输入 git status

时的红色文本

<我希望有人能给我一个关于工作目录官方定义的想法。即使是在线的Pro Git书,看起来似乎有点模糊,至于它是什么。



注意:我每天都用它,我只是想知道它是什么。



干杯

p>

解决方案

From git commit-tree 树表示工作目录的特定目录状态<所以,当工作目录代表其中回购检出时,工作tree 表示其状态

git status 显示工作树,表示工作目录的状态

工作目录引用where,工作树引用什么(它包含了什么,它的文件被跟踪或没有跟踪)

://stackoverflow.com/a/30185564/6309\" > 多个的工作树为指定的本地回购。

这意味着您将使用多个工作目录(使用 git worktree add< path> [< branch>] ),并且每个工作目录可以包含一个不同的工作树:例如,可以为每个路径检出不同的分支,这意味着每个目录包含不同的 em>相同的回购:多个工作树。


In my experience so far with reading about GIT, I have found that Working Directory seems to be a bit of an overloaded term. Sometimes people mean the directory on the hard drive into which a branch is checked out e.g. when cloning a repo, the branch is checked out into the directory of the new clone of the repo.

But sometimes people just mean an abstract location which contains untracked files and modified files i.e. the red text when you enter git status

I was hoping someone could give me an idea of the official definition of the working directory. Even that online Pro Git book seems to be a bit vague as to exactly what it is.

Note: I use it every day, I just want to know what it is.

Cheers

解决方案

From git commit-tree, a tree represents a particular directory state of a working directory.

So while the working directory represents where a repo is checked out, a working tree represents its status.
A git status shows a "working tree", meaning the state of a working directory.

A working directory references the "where", a working tree references the "what" (what it contains, its files tracked or not tracked)

Note that git 2.5 (Q2 2015) will allow multiple working trees for a given local repo.
That means you will use multiple working directories (with git worktree add <path> [<branch>]), and each working directory can contain a different working tree: you can checkout different branches per path, for instance, which means each directory contains a different state of the same repo: multiple working trees.

这篇关于什么是GIT存储库的工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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