Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to git gc / prune on a remote Git repository hosted by TFS 2013?

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?

like image 345
jaccus Avatar asked Jul 16 '15 12:07

jaccus


People also ask

Can I use Git and TFS together?

Introducing git-tfsgit-tfs provides a two-way bridge between a local Git repository and a TFS server. git-tfs allows you to do your local development in a Git repository, and still synchronize your work with a TFS server.

What Git gc -- prune now does?

git gc is a parent command and git prune is a child. git gc will internally trigger git prune . git prune is used to remove Git objects that have been deemed inaccessible by the git gc configuration.

When should you not run Git gc?

Running git gc manually should only be needed when adding objects to a repository without regularly running such porcelain commands, to do a one-off repository optimization, or e.g. to clean up a suboptimal mass-import.

Which is better TFS or Git?

You should use Git for version control in your projects unless you have a specific need for centralized version control features in TFVC. In other words, if you have a very specific reason why you need to continue using TFVC, Microsoft would rather you didn't.


1 Answers

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."

like image 144
Janusz Nowak Avatar answered Oct 07 '22 11:10

Janusz Nowak