Skip to content

Instantly share code, notes, and snippets.

@dogterbox
Created February 23, 2023 06:55
Show Gist options
  • Save dogterbox/26eb544140490d0cc5f0d152804f8541 to your computer and use it in GitHub Desktop.
Save dogterbox/26eb544140490d0cc5f0d152804f8541 to your computer and use it in GitHub Desktop.
Cleanup files with git-filter-repo
# upgrade git
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git -y
# install git-filter-repo
pip3 install git-filter-repo
# cleanup files
# --invert-paths is remove dir
git filter-repo --path <file-or-dir> --invert-paths --force
# push to remote
git remote add origin <remote-url>
git push --set-upstream origin <branch-name> --force
@dogterbox
Copy link
Author

dogterbox commented Sep 1, 2023

@dogterbox
Copy link
Author

dogterbox commented Sep 1, 2023

after running git filter-repo ...
when check git status
you see nothing to commit or change
don't worry, pls next step (pushing...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment