我正在使用 git 2.3.0。并尝试在远程存储库中查找 3 个最新提交 myremote
.
$: git remote
origin
myremote
我希望命令
git log -3 --decorate --remotes=myremote
会达到我想要的。但是,我可以看到不严格来自
myremote
的日志.Example.
$: git remote
commit 63d8a59f6 (myremote/branch1)
...
commit 63d8a59f6 (myremote/branch2)
...
commit 63d8a59f6 (origin/branch3)
...
在上面的例子中,我希望看不到来自
origin
的任何内容。 .
最佳答案
这是 functionality for --remotes
的微妙之处:
--remotes[=<pattern>]
Pretend as if all the refs in refs/remotes are listed on the command line as
<commit>.
Git 是 查看来自
myremote
的分支的提交哈希.但是由于您的 origin/branch3
也指向来自 myremote
的散列分支,它显示在日志输出中。功能上
git log --remotes=myremote
是相同的
git log <hash1> <hash2> <hash3> ... <hashN>
其中每个散列取自
.git/refs/remotes/myremote/
中文件的内容
关于git - 仅显示特定远程的 git commit 日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29987429/