Forrest logo
back to the git tool

git-filter-repo:tldr:e76ba

git-filter-repo: Extract a single folder, keeping history.
$ git filter-repo --path ${path-to-folder}
try on your machine

The git filter-repo --path ${path-to-folder} command is used to filter the history of a Git repository, retaining only the commits, branches, and tags that affect the specified folder or subdirectory.

Here's a breakdown of the command:

  • git filter-repo is a command-line tool designed to rewrite Git repository history.
  • --path ${path-to-folder} is a flag that specifies the path to the folder or subdirectory for which the history should be filtered. The ${path-to-folder} should be replaced with the actual path to the desired folder.

When the command is executed, Git filter-repo will traverse the entire history of the repository and remove all commits, branches, and tags that do not affect the specified folder or subdirectory. This can be useful when you want to extract a particular folder from a larger repository or when you want to slim down the repository by removing unnecessary history.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool