npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-bfg

v1.0.5

Published

BFG Repo-Cleaner for Node.js

Readme

BFG Repo-Cleaner for Node.js

Version Downloads/week Downloads/total License PRs Welcome

Introducation

使用 bfg 完成git仓库敏感数据等的清洗,本工具旨在对bfg做封装,免去手动下载bfg的jar包和安装jre环境。参数传递和bfg一致

Usage

1. Clone 镜像仓库

git clone --mirror git://example.com/my-repo.git

git --mirror 是 Git 提供的一种特殊模式,它可以将一个仓库完全复制到另一个仓库中,并且可以保留所有 Git 的元数据,包括分支、标签和提交记录等。这种模式主要用于仓库的备份、迁移、克隆和协作等场景。

使用 git --mirror 模式可以创建一个镜像仓库,它可以与源仓库保持完全一致,并且可以随时更新。当您对源仓库进行更改时,可以使用 git push --mirror 命令将这些更改同步到镜像仓库中。另外,如果您想要从镜像仓库创建一个新的本地仓库,可以使用 git clone --mirror 命令进行克隆。

需要注意的是,git --mirror 模式会复制所有分支和提交记录,因此请务必小心操作。如果您不小心将镜像仓库中的某个分支或提交记录删除了,这些更改也将在源仓库中删除。因此,在使用 git --mirror 模式时,请务必谨慎并备份好您的数据。

2. 执行清洗命令(预操作,未提交)

# 根据 replace-text.txt 的规则清洗仓库,规则样例请查看仓库下的 replace-text-emaple.txt
npx node-bfg --replace-text replace-text.txt my-repo

# 删除所有文件名为 'id_rsa' 或者 'id_dsa'的 文件
npx node-bfg --delete-files id_{dsa,rsa}  my-repo

# 删除所有大于50兆字节的Blob文件
npx node-bfg --strip-blobs-bigger-than 50M  my-repo

# 删除所有名为“.git”的文件夹或文件 - 这是Git中的保留文件名。当从其他源代码控制系统(如Mercurial)迁移到Git时,这些文件经常会成为问题
npx node-bfg --delete-folders .git --delete-files .git  --no-blob-protection  my-repo

3. 完成清洗

cd my-repo
git reflog expire --expire=now --all && git gc --prune=now --aggressive

4. 提交

git push

详情请查看 https://rtyley.github.io/bfg-repo-cleaner/

Problem

Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

 * commit 97b21a90 (protected by 'HEAD')

加上 --no-blob-protection 参数即可(不安全)

--no-blob-protection allow the BFG to modify even your latest commit. Not recommended: you should have already ensured your latest commit is clean.