Content Editing Options
Content editing options allow you to modify file contents or remove specific files based on size or blob ID.Text Replacement
—replace-text
Replace text patterns found in file contents.Reads expressions from a file. Each expression found in files will be replaced with Usage:
***REMOVED*** by default.Type: Path to expressions fileDefault replacement: ***REMOVED***Expression formats:- Plain text (default) - Treated as literal string
regex:PATTERN- Regular expressionglob:PATTERN- Glob pattern
==>REPLACEMENTExample expressions file (secrets.txt):Binary files (containing null bytes in first 8KB) are skipped automatically.
Blob Removal
—strip-blobs-bigger-than
Remove files larger than the specified size.Type: Size with suffix (K, M, G)Size suffixes:
K- Kilobytes (1024 bytes)M- Megabytes (1024²)G- Gigabytes (1024³)- No suffix - bytes
—strip-blobs-with-ids
Remove specific blob objects by their SHA-1 hash.Reads git object IDs from a file (one per line) and removes all of them from history.Type: Path to file containing blob IDsFormat: One SHA-1 hash per lineExample blob IDs file (blobs-to-remove.txt):Finding blob IDs:Usage:
Usage Examples
Remove Passwords from All Files
Create expressions file (passwords.txt):Remove Large Binary Files
Remove Specific Problem Files
Step 1: Identify blob IDsCombined Content Filtering
Expression File Syntax
Basic Format
Escaping Special Characters
Important Notes
Binary File HandlingFiles containing null bytes (
\0) in the first 8KB are automatically skipped by --replace-text to avoid corrupting binary files.Case Sensitivity
Text replacement is case-sensitive by default. Use regex with case-insensitive flag:Performance Considerations
--replace-textprocesses every file in every commit- Complex regex patterns can slow down filtering
- Consider using path filters to limit scope:
Finding Large Files
Before removing large files, identify them:- Blob sizes
- File paths
- Commit history
See Also
- Path Options → - Filter by file path
- Commit Options → - Modify commit messages
- Examples → - Sensitive data removal examples
