Created
March 24, 2009 15:13
-
-
Save dysinger/84140 to your computer and use it in GitHub Desktop.
Convert Chef Cookbooks to Headless Branches
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
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
`git checkout opscode/master` | |
Dir.glob("*").select {|x| FileTest.directory?(x) }.each do |path| | |
`git br -D #{path}` | |
`git checkout -b #{path} opscode/master` | |
`git filter-branch --tree-filter \ | |
'rm -rf #{Dir.glob("*").reject {|x| x == path }.join(" ")}' --prune-empty HEAD` | |
`rm -rf .git/refs/original` | |
`git reset --hard HEAD` | |
`git checkout opscode/master` | |
end | |
`git checkout master` | |
`git gc --aggressive` | |
`git prune` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment