Output and Control Options
Options that control where git-filter-repo reads from and writes to, plus general operational controls.Location Options
—source
Git repository to read from.Type: Path to git repositoryDefault: Current directory (
.)Effect: Implies --partialSpecifies a different repository to read history from. When used with --target, allows filtering from one repository into another without mixing old and new history.Example:Using
--source automatically enables --partial mode.—target
Git repository to overwrite with filtered history.Type: Path to git repositoryDefault: Current directory (
.)Effect: Implies --partialSpecifies a different repository to write filtered history to. The target repository will be overwritten with the filtered history.Example:Operational Mode Options
—force, -f
Bypass fresh clone checks and rewrite history anyway.Aliases:
-fWarning: History rewriting is IRREVERSIBLEBy default, git-filter-repo checks if the repository is a fresh clone to prevent accidental data loss. This flag bypasses those safety checks.When to use:- You’re certain you have backups
- Repository fails fresh clone checks but you want to proceed anyway
- You’re running git-filter-repo multiple times on the same repo
—partial
Perform partial history rewrite, mixing old and new history.Effects:
- Disables
refs/remotes/origin/*→refs/heads/*migration - Disables removal of
originremote - Disables removal of unexported refs
- Disables reflog expiration
- Disables automatic
git gc - Changes
--tag-renameand--refname-callbackto create new refs instead of replacing
--source--target--refs
—refs
Limit history rewriting to specified refs.Type: One or more ref specificationsEffect: Implies
--partialFormat: Same as git fast-export (ref names, ranges, globs)Only the specified refs will be rewritten. All other refs remain unchanged.Examples:This can cause issues with degenerate merge pruning when negative revisions are specified.
—dry-run
Preview changes without modifying the repository.Effects:
- Runs
git fast-exportand filters output - Saves original export to
.git/filter-repo/fast-export.original - Saves filtered export to
.git/filter-repo/fast-export.filtered - Does NOT modify repository
- Does NOT run
git fast-import - Disables commit message hash rewriting (new hashes unknown)
- Disables some empty commit filtering (can’t query fast-import)
—debug
Show additional debugging information.Output includes:
- Commands being run
- File locations for input/output
- Processing steps
- Extra operational details
--dry-run: Shows what WOULD be runWithout --dry-run: Shows what IS being runExample:Input Options
—stdin
Read fast-export stream from stdin instead of running git fast-export.Requirements:
- Input must be in expected fast-export format
- Must include
original-oiddirectives
- Custom pre-processing of export stream
- Combining multiple export streams
- Testing with pre-generated exports
Sensitive Data Removal
—sensitive-data-removal, —sdr
Enable sensitive data removal mode.Aliases:
--sdrAdditional actions:- Fetches all refs from origin (unless
--no-fetch) - Tracks and reports first changed commits
- Tracks orphaned LFS objects
- Provides detailed cleanup instructions
—no-fetch
Skip the automatic fetch when using
--sensitive-data-removal.Effect: Prevents overwriting local-only changesRisk: May leave sensitive data in unfetched refsAutomatically enabled by: --partial or any flag implying --partialExample:Output Control
—quiet
Suppress progress output and pass
--quiet to git commands.Example:—no-gc
Skip running
git gc after filtering.Default behavior: Runs git gc --aggressive after filteringUse --no-gc when:- You’ll run multiple filter-repo commands
- You want to run gc manually later
- You’re doing partial filtering
Ordering Options
—date-order
Process commits in commit timestamp order.Default: Topological order (parents before children)Effect: Processes commits by author/commit date insteadExample:
Utility Options
—help, -h
Show help message and exit.Aliases:
-hExample:—version
Display git-filter-repo version and exit.Example:
—analyze
Analyze repository without modifying it.Output: Creates reports in Learn more about analysis →
.git/filter-repo/analysis/Reports include:- Blob sizes by path/extension
- Path renames over time
- Large objects
- Directory statistics
—proceed
Avoid triggering the no-arguments-specified check.Use this when you want to run git-filter-repo with only callback options and no filtering flags. Without this flag, git-filter-repo will complain if you don’t specify any filtering options.Example:
Usage Examples
Filter Between Repositories
Dry Run Before Real Filtering
Multiple Sequential Filters
Sensitive Data Removal
Partial History Rewrite
Important Notes
Mixing Old and New History
--partial mode mixes old and new history. This is usually not what you want for a clean history rewrite.See Also
- CLI Overview → - All command options
- Path Options → - Filter by path
- Content Options → - Modify content
- Examples → - Real-world usage
