【发布时间】:2012-11-09 17:01:07
【问题描述】:
是否可以在同一个本地存储库(== 共享 .git 目录)上有两个工作树(两个不同的分支)?
【问题讨论】:
是否可以在同一个本地存储库(== 共享 .git 目录)上有两个工作树(两个不同的分支)?
【问题讨论】:
alternates 可能有助于在多个 .git/-目录之间共享一个对象存储。在以下位置检查“对象/信息/替代”:
http://www.kernel.org/pub/software/scm/git/docs/gitrepository-layout.html
【讨论】:
--shared 选项似乎是关键。
是的。但是您需要将第二个分支 workdir 放在第二个目录中,并手动管理交换。
--work-tree=<path>
Set the path to the working tree. It can be an absolute path or a path relative
to the current working directory. This can also be controlled by setting the
GIT_WORK_TREE environment variable and the core.worktree configuration variable
(see core.worktree in git-config(1) for a more detailed discussion).
这使您可以根据需要签出到任意数量的工作树/目录,并根据您声称已经签出的任何分支以任何顺序重新签入。
但是,如果您犯了一些错误,请不要感到惊讶。有点像拿着剪刀跑。
【讨论】:
不,你必须制作两个克隆。
【讨论】: