什么是.git / branches文件夹用于? [英] What is the .git/branches folder used for?
问题描述
我总是认为 .git / branches
目录是为了遗留目的,而git用于使用该目录,但现在使用 .git / refs
目录。这是真的?如果没有,那么该目录的目的是什么,因为我从来没有见过它被使用或引用。
编辑
现在稍微不推荐使用 .git / branches
在有用的 gitrepository-layout
文档:
分支:A稍微弃用的方式来存储用于指定 git fetch , git pull 和 git push 命令的URL的简写方式是将文件存储在 branches /< name> ,并为这些命令赋予 name 以代替存储库参数。 b在上面的评论中,问题引发了为什么一些人有这个目录,有些人没有。看来 2009年推出了一个提交,它阻止了创建
.git / branches
目录。但是,最近更改了已被还原(即意味着.git / branches
将会在git init
等等上创建),以下是Junio C.的理由。 Hamano:
没有足够的理由这样做。我们不会更新 .git / branches 和 .git / remotes 中的
元素,但仍会从中读取
信息并继续执行所以。
另外,这在t55中打破了很多测试?系列。
I have always assumed that the
.git/branches
directory is for legacy purposes and that git used to use that directory, but now uses the.git/refs
directory instead. Is this true? If not, then what is the purpose of that directory since I have never seen it used or referenced.EDIT
I'm using git version 1.7.3.4.
解决方案The now "slightly deprecated" use of
.git/branches
is described in the usefulgitrepository-layout
documentation:branches: A slightly deprecated way to store shorthands to be used to specify URL to git fetch, git pull and git push commands is to store a file in branches/<name> and give name to these commands in place of repository argument.
In the comments above, the question was raise of why some people have this directory and some don't. It seems that a commit was introduced in 2009 that stopped git from creating the
.git/branches
directory by default. However, more recently that change was reverted (i.e. meaning that the.git/branches
will be created ongit init
, etc.), with the following justification from Junio C. Hamano:There is not enough justification for doing this. We do not update things in .git/branches and .git/remotes anymore, but still do read information from there and will keep doing so.
Besides, this breaks quite a lot of tests in t55?? series.
这篇关于什么是.git / branches文件夹用于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!