Created
November 21, 2008 21:15
-
-
Save quinn/27632 to your computer and use it in GitHub Desktop.
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 | |
# super hacky git-export command | |
case ARGV.length | |
when 0 | |
puts 'usage:' | |
puts "git-export [target] : defaults repository to CWD" | |
puts "git-export [repository] [target]" | |
exit 1 | |
when 1 | |
target = ARGV[0] | |
repo = '.' | |
when 2 | |
target = ARGV[1] | |
repo = ARGV[0] | |
end | |
temp = '/tmp/.tmpcheckout' | |
exit 1 unless `git clone #{repo} #{temp}` | |
exit 1 unless `rsync -tr #{temp}/ #{target} --exclude='.git'` | |
exit 1 unless `rm -rfv #{temp}` | |
puts 'success.' | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment