Extract a single folder, keeping history

git filter-repo

  • A versatile tool for rewriting Git history.
    See also: `bfg`.
    More information: <https://github.com/newren/git-filter-repo>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

git-filter-repo --path {{path/to/folder}}

click the source code to copy install git filter-repo on any operating system with command-not-found.com