Skip to main content

Output and Control Options

Options that control where git-filter-repo reads from and writes to, plus general operational controls.

Location Options

—source

string
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

string
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:
The target repository will be completely overwritten. Make sure you have backups.

Operational Mode Options

—force, -f

boolean
default:"false"
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
Example:
DO NOT use --force habitually. Always work in a fresh clone when possible. If you need --force, make absolutely sure you have backups.

—partial

boolean
default:"false"
Perform partial history rewrite, mixing old and new history.Effects:
  • Disables refs/remotes/origin/* → refs/heads/* migration
  • Disables removal of origin remote
  • Disables removal of unexported refs
  • Disables reflog expiration
  • Disables automatic git gc
  • Changes --tag-rename and --refname-callback to create new refs instead of replacing
Automatically enabled by:
  • --source
  • --target
  • --refs
Example:
Partial rewrites mix old and new history. Use with caution as this can lead to confusion.

—refs

string[]
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

boolean
default:"false"
Preview changes without modifying the repository.Effects:
  • Runs git fast-export and 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)
Example:
Always test with --dry-run first for complex operations.

—debug

boolean
default:"false"
Show additional debugging information.Output includes:
  • Commands being run
  • File locations for input/output
  • Processing steps
  • Extra operational details
With --dry-run: Shows what WOULD be runWithout --dry-run: Shows what IS being runExample:

Input Options

—stdin

boolean
default:"false"
Read fast-export stream from stdin instead of running git fast-export.Requirements:
  • Input must be in expected fast-export format
  • Must include original-oid directives
Use cases:
  • Custom pre-processing of export stream
  • Combining multiple export streams
  • Testing with pre-generated exports
Example:

Sensitive Data Removal

—sensitive-data-removal, —sdr

boolean
default:"false"
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
Example:
May discard local-only changes during fetch. Use --no-fetch if you have unpushed changes.

—no-fetch

boolean
default:"false"
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

boolean
default:"false"
Suppress progress output and pass --quiet to git commands.Example:

—no-gc

boolean
default:"false"
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
Example:

Ordering Options

—date-order

boolean
default:"false"
Process commits in commit timestamp order.Default: Topological order (parents before children)Effect: Processes commits by author/commit date insteadExample:

Utility Options

—help, -h

boolean
Show help message and exit.Aliases: -hExample:

—version

boolean
Display git-filter-repo version and exit.Example:

—analyze

boolean
default:"false"
Analyze repository without modifying it.Output: Creates reports in .git/filter-repo/analysis/Reports include:
  • Blob sizes by path/extension
  • Path renames over time
  • Large objects
  • Directory statistics
Example:
Learn more about analysis →

—proceed

boolean
default:"false"
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

Fresh Clone Requirementgit-filter-repo expects to run on a fresh clone. Use --force to override this check, but ONLY if you have backups.
Mixing Old and New History--partial mode mixes old and new history. This is usually not what you want for a clean history rewrite.
Always Test FirstUse --dry-run and --debug for complex operations:

See Also