Search code examples
gitversion-controlazure-devopsdvcs

Retrieve Git push history?


Does Git record the history of pushes to a remote anywhere?

I noticed that we're able to view the push history of our Git repositories in Microsoft VSTS and the associated commits with each push. It even displays old, obsolete commits which should not exist anymore due to later force pushes that rewrote the commit history. Is this additional info specially provided by VSTS and not built into Git?


Solution

  • It's because VSTS does not implement git gc for its repos. Even if the commits are no longer referenced (such as due to a force push), they stick around.

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