git log origin/develop 给出 "fatal: ambiguous argument"
git log origin/develop gives "fatal: ambiguous argument"
Context: 我正在制作一个工具来分析两个分支之间的差异。我想查看 origin/develop
和 origin/release
上的提交历史记录。因为我只需要历史,所以我克隆了只有历史的项目 (git clone --bare
)
在 git fetch
之后,我希望看到发布和开发的最新提交,而不必在每个分支上 git merge origin/develop|release
。所以我试着 git log origin/develop [... format options]
.
在某些项目中,它按预期工作。但是在一个特定的项目中,我得到了这个错误:
$ git log origin/develop master * ] 11:01
fatal: ambiguous argument 'origin/develop': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
如果我尝试 git remote -v
,我可以看到 origin
的定义是正确的。 origin/develop
怎么可能不是有效的修订版?
引用the documentation of the --bare
flag:
Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to refs/remotes/origin
如果在没有 --bare
标志的情况下克隆存储库,此 git log
选项将起作用。
编辑:
要回答评论中的问题,这也意味着您可以直接调用 git log <branchname>
,而无需引用 origin/<branchname>
。即,在您的情况下:
git log develop
Context: 我正在制作一个工具来分析两个分支之间的差异。我想查看 origin/develop
和 origin/release
上的提交历史记录。因为我只需要历史,所以我克隆了只有历史的项目 (git clone --bare
)
在 git fetch
之后,我希望看到发布和开发的最新提交,而不必在每个分支上 git merge origin/develop|release
。所以我试着 git log origin/develop [... format options]
.
在某些项目中,它按预期工作。但是在一个特定的项目中,我得到了这个错误:
$ git log origin/develop master * ] 11:01
fatal: ambiguous argument 'origin/develop': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
如果我尝试 git remote -v
,我可以看到 origin
的定义是正确的。 origin/develop
怎么可能不是有效的修订版?
引用the documentation of the --bare
flag:
Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them to
refs/remotes/origin
如果在没有 --bare
标志的情况下克隆存储库,此 git log
选项将起作用。
编辑:
要回答评论中的问题,这也意味着您可以直接调用 git log <branchname>
,而无需引用 origin/<branchname>
。即,在您的情况下:
git log develop