Skip to content

Instantly share code, notes, and snippets.

@vinnie357
Last active February 10, 2021 21:22
Show Gist options
  • Save vinnie357/f73daf15585ec586e0307090cb9a66ae to your computer and use it in GitHub Desktop.
Save vinnie357/f73daf15585ec586e0307090cb9a66ae to your computer and use it in GitHub Desktop.
# repo history cleanup
# https://rtyley.github.io/bfg-repo-cleaner/
# https://github.com/IBM/BluePic/wiki/Using-BFG-Repo-Cleaner-tool-to-remove-sensitive-files-from-your-git-repo
download bfg jar file
# https://search.maven.org/classic/remote_content?g=com.madgag&a=bfg&v=LATEST
```bash
curl https://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar > bfg.jar
git clone http://yourrepo
cd yourrepo
git pull yourbranch
git checkout yourbranch
java -jar ../bfg.jar --delete-files yourfile.txt
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git commit -m "my new state"
git reset --hard <commit>
git push --force
```
## https://stackoverflow.com/questions/25436312/gitignore-not-working
The files/folder in your version control will not just delete themselves just because you added them to the .gitignore. They are already in the repository and you have to remove them. You can just do that with this:
(Remember to commit everything you've changed before you do this.)
```bash
git rm -rf --cached .
git add .
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment