git - .git/branches 文件夹的用途是什么?

标签 git

我一直认为 .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/

相关文章:

git - 如何使用 Rust git2 crate 执行 "git pull"?

git - Ansible sudo_user 没有使用正确的 $HOME 目录

eclipse - 如何在 EGit 中使用子模块

Git 向上游推送

git - 如何将 Git 存储库转移到另一个 Git 存储库的主分支

linux - .git 文件夹的奇怪行为

ios - 在 .gitmodules 中找不到子模块路径 'Pods' 的 url

git - 从 master 中删除 merge

git - Git 中的什么等同于 ClearCase 中的只读组件?

git - 如何删除 Git 存储库中的多个已删除文件