Is there a way to run git gc --prune=now
on remote Team Foundation Server 2015 (tfs2015)? Or is the only way to run git gc --prune=now
locally then create new repository on tfs2015 and push it to new remote, then delete the old repository, and rename new repository to old name. Don't forget to turn off the liking commit when doing that.
See https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old-unreferenced-objects/ - this is a known limitation of TFS-hosted git, it doesn't have the gc
command.
Microsoft provides two workarounds:
don't git clone
, but obtain your local repo like this:
mkdir newRepo
git init
git remote add origin
#fetch one branch first
git fetch origin master
#fetch everything else
git fetch origin
which tricks TFS to actually send you only the objects you really need.
Option 1 seems to be more reasonable to me if you can afford losing your pull requests etc (e.g. if this is a relatively new repo).
Option 2 feels really bad, as any user of the repo will have to manually create their clone this way.
Update about comming this in TFS v.Next And all ready rolled out in VSTS https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old-unreferenced-objects/ "UPDATE (2017-08-09): 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). As Brian Harry mentioned, we should have a release candidate for v.Next in a few weeks."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With