【发布时间】:2015-04-08 16:13:35
【问题描述】:
我正在尝试设置一个本地 Git 存储库,该存储库使用来自另一个存储库的特定分支作为起始模板(可能会拉取对模板的更改,但从不——或至少几乎从不——推送到模板)并且我'对两种方法之间的区别感到困惑:
如果我
git clone --origin framework --branch template <repo_url> <repo_directory> --single-branch
cd <repo_directory>
git remote set-url --push framework DISABLED
我有一个remotes/framework/HEAD 远程分支,而如果我改为
mkdir <repo_directory>
cd <repo_directory>
git init
git remote add framework <repo_url>
git pull framework template:template
除了没有remotes/framework/HEAD之外,其他一切都(或至少看起来)相同。
什么是remotes/framework/HEAD,为什么它出现在一种方法中而不是另一种方法中?
我收集到在任何一种情况下防止推送到远程仓库的唯一方法是使用类似
git remote set-url --push framework DISABLED
但如果有另一种方法(除了上述两种)来配置满足我目标的本地存储库,我想听听。
【问题讨论】:
标签: git git-push git-pull git-clone git-remote