git - 仅显示特定远程的 git commit 日志?

标签 git

我正在使用 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/

相关文章:

git - 如何在 Windows 中克隆包含 Windows 文件系统无效符号的存储库

git - 在 merge 了精选提交的分支上 pull 请求

html - GitHub 页面发布链接无效

git - 如何让 Gerrit 的代码审查在成功提交时输出电子邮件差异?

git:用于临时和生产服务器的推和 pull

git - 卡在 Windows 上的 Git : Can't checkout, 无法存储,无法提交

python - GitPython 中的 `git ls-remote`

windows - 运行批处理文件时 cmd 中的奇怪输出

git - 在azure devops中创建的每个git存储库的大小限制是多少

git - 如何让git pull 所有分支的更改