-
-
Save vielhuber/6ab7686fc508ce87c52b10bb5d01ee51 to your computer and use it in GitHub Desktop.
Bitbucket: Remove folder from history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir testrepo && cd testrepo | |
git clone git@bitbucket.org:vielhuber/testrepo.git . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir foo && cd foo | |
seq -w 1 900 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=file.% bs=1024 count=1024' | |
cd .. && mkdir bar && cd bar | |
seq -w 1 900 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=file.% bs=1024 count=1024' | |
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git add -A . && git commit -m "initial push with some data" && git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git count-objects -vH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo /foo/ >> .gitignore | |
git rm -rf --cached foo/ | |
git add -A . | |
git commit -m "removed /foo/ from git history" | |
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd .. | |
wget http://repo1.maven.org/maven2/com/madgag/bfg/1.12.15/bfg-1.12.15.jar | |
mkdir testrepo-clean | |
git clone --mirror git@bitbucket.org:vielhuber/testrepo.git testrepo-clean | |
java -jar bfg-1.12.15.jar --delete-folders foo testrepo-clean | |
cd testrepo-clean | |
git reflog expire --expire=now --all && git gc --prune=now --aggressive | |
git push | |
cd .. | |
rm -rf testrepo-clean.bfg-report | |
rm bfg-1.12.15.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd testrepo-clean | |
git count-objects -vH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment