正确使用BFG回购清洁剂 [英] Correct Usage of BFG Repo Cleaner

查看:87
本文介绍了正确使用BFG回购清洁剂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BFG Repo Cleaner 网站提供了使用该工具的示例,如下所示清理存储库:

The BFG Repo Cleaner site gives an example of using the tool as follows to clean up a repository:

  1. 克隆您的存储库的新副本.

  1. Clone a fresh copy of your repo.

$ git clone --mirror git://example.com/some-big-repo.git

  • 运行BFG清理您的存储库.

  • Run BFG to clean up your repo.

    $ java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
    

  • 使用git gc清除不需要的脏数据

  • Use git gc to strip out the unwanted dirty data

    $ cd some-big-repo.git
    $ git reflog expire --expire=now --all && git gc --prune=now --aggressive
    

  • 将更改推回至远程

  • Push changes back up to the remote

    $git push
    

  • 我知道head分支受到保护,因此head分支中任何大于100M的文件仍将存在.如果我按照说明运行此工具,我会丢失所说100M文件正确的任何历史记录吗?因此,如果在旧提交中存在该文件的旧版本,则该文件已消失,而我将无法在其先前状态下使用它....正确吗?

    I understand the head branch is protected so any file in the head branch that is larger than 100M will still be there. If I run this tool as described I will lose any history of said 100M file correct? So if there is an old version of that file in an old commit it's gone and I will not be able to use it in it's previous state....correct?

    另外,我有一个同事说了以下内容,我想知道这是否是真的:

    Also, I have a coworker that stated the following and I am wondering if it is true:

    如果您返回到TFS中已镜像的存储库,则对打包文件的更改将不会反映在远程克隆和以后的克隆中

    If you push back to the repository that was mirrored in TFS the changes to your pack file won't be reflected on the remote and future clones

    您必须在TFS中创建一个新的存储库,然后将镜像推到那里,以供远程用户选择打包文件的更改.

    You have to create a new repository in TFS and push the mirror there for the remote to pick of the pack file changes.

    推荐答案

    回购文件HEAD上仍然存在的任何文件都将被保留,包括历史记录.这是为了保护您避免犯错误.这个想法是,您应该明确删除文件,提交删除,然后清理历史记录以将其删除.

    Any file still present at the HEAD of the repo will be preserved, including the history. It's to protect you from making mistakes. The idea is that you should explicitly delete the file, commit the deletion, then clean up the history to remove it.

    TFS不会gc它的存储库;你的同事是正确的.请参阅 Team Foundation Server 2015( tfs2015)在org/remote上运行git gc --prune = now 进行确认.

    TFS does not gc its repos; your colleague is correct. See Team Foundation Server 2015 (tfs2015) run git gc --prune=now on orgin/remote for confirmation.

    这篇关于正确使用BFG回购清洁剂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆