git - 当我使用 git-subtree 时,为什么我被告知 "' master' does not refer to a commit?

标签 git git-subtree

当我输入 > git subtree add --prefix=<some dir> --squash <some repo> master我收到消息 'master' does not refer to a commit .如果我将“master”更改为 sha,我仍然会收到警告。 repo 是有效的,主人存在于我试图 pull 入的 repo 中。

最佳答案

我最终找到了this commit重要的信息是

This patch:

  • relaxes the check the argument in "git subtree add " (previous code would not accept a ref name that does not exist locally too, new code only ensures that the ref is well formatted)

我的问题是我的本地存储库没有名为 master 的分支(语义版本控制)。 简单的解决方法是创建一个名为 master 的本地分支(或者您尝试从中提取的分支的任何名称。这解决了此处看到的问题:Adding git subtree from a branch Geoff Ryan 可以创建一个名为 cow 的本地分支并成功使用了子树)

这应该有望在 git 1.9 中得到解决,但是对于使用早期版本的任何人,我希望这可以让您避免一些挫败感。

关于git - 当我使用 git-subtree 时,为什么我被告知 "' master' does not refer to a commit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21500722/

相关文章:

git - 我可以从子目录进行子树 merge 吗?

git - 列出在两次 git 提交之间添加或删除的目录

git - Jenkins 构建屏幕上的 SCM 更改是如何确定的?

django - 自定义 Django 应用程序和贡献/merge 上游的工作流

git-subtree pull merge 冲突

windows - Git 检测到实际字节相同的已更改文件

用于修复错误的 Git 流分支

GIT 获取当前状态下每个文件的第一个标签

git - 使用 Zend Repo 作为 Origin 从 master 创建一个本地 Git repo

git子树添加: change prefix preserving local commits