Created
January 25, 2012 22:23
-
-
Save Sharpie/1679252 to your computer and use it in GitHub Desktop.
Shell script for stripping all Formula-related commits out of a Homebrew repository
This file contains hidden or 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
#!/usr/bin/env bash | |
# Change to repository prefix so that git commands will work. | |
cd `brew --prefix` | |
# Ensure Homebrew is up to date and create a new branch called homebrew-core | |
brew update | |
git checkout master | |
git branch -D homebrew-core | |
git branch homebrew-core | |
# Create a ramdisk to run filter ops on in order to save the real disks some | |
# wear and tear. | |
diskutil erasevolume HFS+ "brew_core_tmp" `hdiutil attach -nomount ram://640000` | |
git filter-branch -f \ | |
-d /Volumes/brew_core_tmp \ | |
--index-filter "git rm -q -r --cached --ignore-unmatch Library/Formula Library/Aliases" \ | |
--prune-empty homebrew-core | |
# Dispose of the RAM disk. | |
umount /Volumes/brew_core_tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment