Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Forked from dysinger/convert.rb
Created March 30, 2009 22:21
Show Gist options
  • Save jtimberman/87916 to your computer and use it in GitHub Desktop.
Save jtimberman/87916 to your computer and use it in GitHub Desktop.
#!/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