git log origin/develop 给出“致命:模棱两可的论点”

Arn*_*lle 5 git git-log

上下文:我正在制作一个工具来分析两个分支之间的差异。我想查看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>...]'
Run Code Online (Sandbox Code Playgroud)

如果我尝试git remote -v,我可以看到它的origin定义是正确的。怎么可能origin/develop不是有效的修订呢?

Mur*_*nik 1

引用标志的文档--bare

另外,远程的分支头会直接复制到相应的本地分支头,而不会将它们映射到refs/remotes/origin

git log如果在没有该标志的情况下克隆存储库,则此选项将起作用--bare

编辑: 要回答评论中的问题,这也意味着您可以git log <branchname>直接调用,而无需参考origin/<branchname>. 即,就你而言:

git log develop
Run Code Online (Sandbox Code Playgroud)