5

有没有办法git gc --prune=now在远程 Team Foundation Server 2015 (tfs2015) 上运行?或者是在git gc --prune=now本地运行然后在 tfs2015 上创建新存储库并将其推送到新远程的唯一方法,然后删除旧存储库,并将新存储库重命名为旧名称。这样做时不要忘记关闭喜欢的提交。

4

2 回答 2

3

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:

  • clone the repo, clean it locally, delete it from the server, create a new one and push your cleaned one to it (what you described in your question)
  • 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.

于 2016-03-30T11:22:28.503 回答
2

关于在 TFS v.Next 中发布此内容的更新并在 VSTS 中已准备就绪 https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old- unreferenced-objects/ “更新(2017-08-09):我们向 VSTS 推出了提交可达性位图索引,并删除了下面提到的克隆作弊。克隆将不再下载无法访问的对象!我们仍然没有真正的对象级别git gc 在服务器上,但克隆大小现在会更小。

TFS on-prem 将在 v.Next 中获得这些更改(不是在任何 TFS 2017 更新中,而是在下一个主要版本中)。正如 Brian Harry 所提到的,我们应该在几周内发布 v.Next 的候选版本。”

于 2017-09-02T19:20:08.740 回答