LinuxCommandLibrary

git-obliterate

Remove file from entire history

TLDR

Remove file from entire history

$ git obliterate [filename]
copy

SYNOPSIS

git obliterate filename

DESCRIPTION

git obliterate completely removes a file from the entire Git history. This git-extras command rewrites every commit to erase all traces of the specified file, as if it had never been added to the repository.
The operation is useful for removing accidentally committed secrets, sensitive data, or large files that should never have been tracked. It is a convenience wrapper around `git filter-branch` or `git filter-repo`, handling the complexity of full history rewriting. After obliteration, the repository is repacked to reclaim disk space.

CAVEATS

This rewrites history and changes all commit hashes. Coordinate with collaborators before using on shared branches.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community