问题标签 [bfg-repo-cleaner]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1164 浏览

git - 从 GitLab 存储库中永久删除二进制文件

我们有一个 GitLab 托管的存储库,其中包含一些我们想要删除的大型二进制文件。我知道诸如 BFG Repo-Cleaner 之类的工具会从 Git 存储库中删除文件。

我们经常在 GitLab 中引用特定的提交 ID。运行 BFG Repo-Cleaner 会搞砸这些吗?

如果是这样,是否有更好的方法来清理不会弄乱这些的回购?

0 投票
1 回答
2171 浏览

git - Git/Bitbucket - 从整个历史记录/提交中删除文件

按照 BFG 的指示,我继续删除不应出现在 repo/commit 历史记录中的私有文件。

https://rtyley.github.io/bfg-repo-cleaner/

我跑了

并推送更改,但它导致我合并主分支并且文件仍然显示,代码在 .private 文件中,所有提交仍然在历史记录中。

如何从整个 repo 的提交历史等中删除 .private?

0 投票
1 回答
658 浏览

git-rewrite-history - 使用 BFG 回购清理器后,BitBucket 回购变大

我的 BitBucket 存储库中有一大堆不需要的大文件。我删除了它们,然后想从历史记录中清除它们以缩小已经变得太大的回购。

我运行了 BFG 存储库清理器,它报告了 1755 个已找到并已处理的文件——所有这些都是我所期待的。

按照此处的说明运行最终的 git gc:https ://rtyley.github.io/bfg-repo-cleaner/

一切正常 - .git 文件夹缩小到其原始大小的 17%。把它推回去,BitBucket 报告的 repo 大小实际上变大了!

不知道出了什么问题,因为到目前为止一切似乎都正确无误。

感激地收到任何建议,因为我真的不想重新创建 repo 以减小大小。

谢谢

0 投票
1 回答
930 浏览

git-rewrite-history - 需要在使用 bfg repo-cleaner 后克隆 repo 或使用现有的?

阅读 bfg repo-cleaner 的说明,工作流程如下:

  1. 使用 --mirror 选项克隆 repo
  2. 使用 bfg 从不需要的项目中删除 repo
  3. 使用 git gc 物理删除项目
  4. 推送清理过的仓库

但是,我不清楚您是否需要删除自己的工作目录副本并进行新的克隆,或者您是否可以进行拉取以获得干净的回购/历史记录?目前我是唯一一个使用回购的人。

0 投票
2 回答
964 浏览

git - Git Repository Only Gets Bigger After Using BFG

We are currently in the process of migrating our SVN repo to GIT (hosted at bitbucket). I used subgit to import all our branches/history into a bare repo i have locally on my (Windows) PC.

The repo is quite big (7.42 GB after the import) this is because it also contains information about SVN like revision numbers to provide a way to have a two way sync between Git and SVN (I'm only interested in a one way SVN to GIT).

I create a local clone of the imported bare repo and push all the branches to bitbucket. After a couple of hours (!) the repo was fully uploaded. BitBucket now gave me warnings about the repo size. I checked the size and it was 1.1GB. Thats not as big as the imported bare but still to big to have a fast repository.

After playing around with BFG i managed to remove soms large DLL/SQL export files using these commands on the bare repo (I only use the clone for pushing without all the svn-related refs):

This took a while and afterwards the git_find_big.sh script did not show these large sql files anymore. But after pushing things back to bitbucket (as a new repo, not as a force push) it only got bigger (1.8GB)

Can you provide a possible explanation for this behavior?

I don't know if it matters but we used a non standard branch/tag model in svn. This resulted in branches like: /refs/heads/archive/some/path/to/branch. These branches seemed to work just fine and removing them also did not affect the size.

Next to these problems i noticed i had some XML files showing up in the git_find_big.sh output:

These files contain the frontend logic of the web platform we are using and are indeed quite big. But they should be treated as text right? Therefore I don't get why they show up as separate objects in the above output. Am i right this should not be happening?

The SVN import also resulted in some empty commits (for example when SVN creates or moves a branch it needs a new commit). I guess these can only be removed using filter-branch?

Sorry, I have a lot of questions! Could someone help me with this?

Thanks,

Piet

0 投票
0 回答
222 浏览

git - 无论如何在使用 BFG Repo-Cleaner 时围绕一个新的克隆?

使用BFG Repo-Cleaner时,有没有办法不让每个人都进行新的克隆?拥有庞大的团队和多个分支机构,很难组织起来。只要我不必让每个人都重新克隆回购协议,我愿意多次运行 bfg 。

我正在考虑从历史记录中删除文件(即私钥),将它们添加到 .gitignore 文件,git push,并让团队重新设置他们的分支。

希望罗伯托泰利看到这一点,并能提供一些建议。

干杯!

0 投票
1 回答
930 浏览

git-rewrite-history - 可以撤消永久删除文件吗?

我的一位同事试图Diff.java从我们的 GitHub 存储库的历史记录中永久删除一个文件 ( )。

他有充分的理由想要这样做,但是似乎出了点问题,因为我们似乎丢失了很多文件,这些文件已被后缀为.REMOVED.git-id. 例如ivy-2.2.0.jar-> ivy-2.2.0.jar.REMOVED.git-id

我已经设法修复了主要的开发分支,因为我碰巧在本地有一个副本。然而,有许多开发线的历史分支和发布的标签现在似乎以上述方式被破坏。

我了解他运行的过程类似于:

我猜这个过程是破坏性的,除非在这发生之前我们碰巧在某个地方有一个干净的镜子,否则没有办法恢复。任何人都可以确认或提供一些建议吗?

0 投票
2 回答
839 浏览

git - 如何在一个简单的步骤中将 *Foo* 的 *all* 实例(内容、文件名和提交消息)批量替换为 *Bar*?

假设我有一个名为“Hammerstein”的尚未发布的软件产品的巨大存储库,由著名的德国软件公司“Apfel”编写,我是该公司的员工。

有一天,“Apfel”分拆了 Hammerstein 部门并将其出售给著名的公司“Oráculo”,该公司出于民族自豪感将“Hammerstein”重命名为“Reineta”并决定将其开源。

协议要求在存储库中将所有对“Hammerstein”和“Apfel”的引用替换为“Oráculo”和“Reineta”。

所有文件名,所有提交消息,所有内容都必须替换。

因此,例如:

  1. src/core/ApfelCore/main.cpp必须成为src/core/OraculoCore/main.cpp

  2. 说的commit message"Add support for Apfel Groupware Server"必须变成"Add support for Oraculo Groupware Server"

  3. 字符串ApfelServerInstance* local_apfel,#define REINETA并且Url("http://apfel.de")必须变为OraculoServerInstance* local_oraculo,#define HAMMERSTEIN等。

这也适用于不再存在的文件HEAD

以最少的手动干预(以便可以将其批量应用于可能大量的存储库/资产)实现它的最简单和最无痛的方法是什么?

  1. BFG可以替换字符串,但它似乎只有一个--delete-file选项,而不是 a --rename-file,即使这样它也不将模式作为参数
  2. 这种方法似乎只适用HEAD于整个历史,而不适用于整个历史;我没有运气使用它--tree-filter
0 投票
1 回答
505 浏览

git - 使用 bfg 精简 git 存储库

面对编码人员无政府主义地添加二进制文件,如何精简 git 存储库,不仅可以删除有问题的文件,还可以删除它们在树中的历史记录。

我尝试使用bfg,但由于它适用于镜像的裸存储库,因此我在获取整个工作流程方面遇到了困难,需要从网络上的不同地方收集答案。

0 投票
1 回答
1004 浏览

git - 如何缩小 Git 存储库并更好地管理大文件

我过去曾使用过BFG 回购清理器并取得了巨大的成功。我最近也开始修补Git LFS,虽然我还在学习。

我以前有.gitignore很多大文件,当我开始用 LFS 跟踪时,.git/文件夹变得很大(.git/lfs/objects主要是由于)。

  1. 通过使用 Git LFS 跟踪文件,我是否会立即大幅增加我的 repo 大小?到目前为止,这是我的经验,但似乎没有必要(也许)。

我看到BFG 现在支持 Git LFS。它说我可以使用该命令来减小我的 repo 的大小,并使用 LFS 进行跟踪。

  1. 有没有办法指定要使用 BFG 清理然后使用 LFS 跟踪的文件大小,或者它是否只是对所有匹配的文件执行这些操作(基于名称)?

我一直在尝试寻找这些问题的答案,但进展缓慢。