检索 Git 推送历史记录?

Retrieve Git push history?

是否Git记录了推送到远程任何地方的历史记录?

我注意到我们能够在 Microsoft VSTS 中查看 Git 存储库的推送历史记录以及每次推送的相关提交。它甚至显示旧的、过时的提交,由于后来的强制推送重写了提交历史,这些提交不应再存在。此附加信息是否由 VSTS 专门提供且未内置于 Git?

这是因为 VSTS 没有为其 repos 实现 git gc。即使提交不再被引用(例如由于强制推送),它们仍然存在。

参考: https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old-unreferenced-objects/

不确定我是否完全理解你的意思,如果你在下面的截图中谈论远程推送历史。

对于本地回购,您可以查看此线程:

Actually, when you execute git reflog expire --expire=now --all and git gc --prune=now, the danglind commits were removed. You can double check by git fsck --full. If the output doesn’t show commits, that means there has no dangling commits.

但是您无法为远程 git 存储库执行任何 git 命令,这应该是由 this 引起的,正如丹尼尔在上面提到的:

We rolled out commit reachability bitmap indexes to VSTS and removed the clone cheat mentioned below. Cloning will no longer download unreachable objects!. We still don't have true object-level git gc on the server yet, but clone sizes will be smaller now.

TFS on-prem will get these changes in v.Next (not in any TFS 2017 updates, but the next major release).