工作树vs工作目录

问题描述:

我正在阅读Git v2.9.1的发布说明,其中一项修改如下:

I was reading Git v2.9.1's release notes and one of the changes reads:


git status用于表示工作目录 工作树。

"git status" used to say "working directory" when it meant "working tree".

两者有什么区别?什么时候 git status 是否意味着工作树?

What's the difference between the two? When would git status mean "working tree"?

为了提高一致性并避免模糊不清。正如提交改变了这种行为所述:

This was done to improve consistency and avoid ambiguity. As explained in the commit that changed this behavior:


工作目录可以很容易地与当前目录混淆。

Working directory can be easily confused with the current directory.

是为了更好地消除工作树,这意味着您的存储库已被签出的位置以及当前工作目录,您正在其中运行 git status 命令,这可能在你的工作树下面(或者,如果你设置了 GIT_WORK_TREE 环境变量)

So this change was made to better disambiguate between the working tree, meaning the location where your repository has been checked out, and a the current working directory where you are running the git status command, wich may be somewhere beneath your working tree (or perhaps not, if you set GIT_WORK_TREE environment variable).