Is there a way to git gc / prune on a remote Git r

2019-04-25 20:03发布

问题:

Over time the size of .git folder grows for Git repositories hosted on TFS 2013 (Update 4).

Whenever cloning those repositories, .git folder can be huge in size initially, until git gc --aggressive --prune=now is performed manually.

Microsoft says, that TFS 2013 does not perform git gc operations on its own. Unfortunately, it also seems impossible to force TFS to do that.

Is there a way to gc/prune a Git repository hosted in TFS 2013 to reduce the initial size of .git directory?

回答1:

Found answer here: https://connect.microsoft.com/VisualStudio/feedback/details/1019193/unable-to-clean-a-git-repo-in-tfs

"TFS does not currently perform garbage collection on git objects. We are aware that this is an important feature to have and we are tracking it in our backlogs. Currently, if you perform a git clone, TFS attempts to optimize for processing speed and hands you all objects that were associated with that repo without filtration, under the assumption that almost all of it will be live/reachable. After a filter operation like the one you performed, it might be prudent to delete the entire git repository from your TFS server and create a new one using the locally pruned and repacked git repo. All the standard caveats when deleting a repository apply - you lose all permission information and any TFS state associated with that repository and you will have to recreate them appropriately."