我一直认为 .git/branches
目录是用于遗留目的,并且 git 过去使用该目录,但现在使用 .git/refs
目录反而。这是真的?如果没有,那么该目录的用途是什么,因为我从未见过它被使用或引用过。
编辑
我使用的是 git 版本 1.7.3.4。
最佳答案
有用的 gitrepository-layout
documentation 中描述了 .git/branches
现在“略微弃用”的使用:
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.
在上面的评论中,问题是为什么有些人有这个目录而有些人没有。似乎a commit was introduced in 2009默认情况下,这会阻止 git 创建 .git/branches
目录。然而,最近这种变化was reverted (即意味着 .git/branches
将 在 git init
等上创建),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 - .git/branches 文件夹的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10398225/