MENU
  
# How can I nuke a directory/file from git history?
  # NOTE: There is "git filter-branch" as well but git-filter-repo has better perf and more functionality,
  # even the docs for "git filter-branch" recommends git-filter-repo: https://git-scm.com/docs/git-filter-branch#_warning
  
  git-filter-repo --invert-paths --path external-metric-scripts/ --force
  # re-add the origin remote that git-filter-repo deletes as a precaution:
  git remote add origin $ORIGINAL_CLONE_URL
  # push it back:
  git push --force --mirror origin
  
  git reflog expire --expire=now --all
  git gc --prune=now

  # the explanation for why the remote is deleted is available here:
  # https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#DISCUSSION

  # NOTE: If removing sensitive data from git, consider using --sensitive-data-removal as well?