← 返回命令列表

Linux command

bfg 命令

安全

复制后可按需替换文件名、目录或参数。

常用示例

Remove

bfg --delete-files [secrets.txt] [repo.git]

Remove

bfg --strip-blobs-bigger-than [100M] [repo.git]

Replace

bfg --replace-text [passwords.txt] [repo.git]

Delete

bfg --delete-folders [.svn] [repo.git]

说明

bfg (BFG Repo-Cleaner) is a faster, simpler alternative to git-filter-branch for removing unwanted data from Git repositories. It's designed for cleaning up accidentally committed passwords, large files, or other sensitive data from repository history. The tool is significantly faster than git-filter-branch and easier to use for common cleaning tasks.

参数

--delete-files _pattern_
Delete files matching pattern
--strip-blobs-bigger-than _size_
Remove large blobs (e.g., 100M, 1G)
--replace-text _file_
Replace text patterns (one per line)
--delete-folders _name_
Delete folders by name
--no-blob-protection
Allow deletion in current commit
--private
Treat repo as private (no warnings)

FAQ

What is the bfg command used for?

bfg (BFG Repo-Cleaner) is a faster, simpler alternative to git-filter-branch for removing unwanted data from Git repositories. It's designed for cleaning up accidentally committed passwords, large files, or other sensitive data from repository history. The tool is significantly faster than git-filter-branch and easier to use for common cleaning tasks.

How do I run a basic bfg example?

Run `bfg --delete-files [secrets.txt] [repo.git]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --delete-files _pattern_ do in bfg?

Delete files matching pattern