Skip to content

Instantly share code, notes, and snippets.

@quinn
Created November 21, 2008 21:15
Show Gist options
  • Save quinn/27632 to your computer and use it in GitHub Desktop.
Save quinn/27632 to your computer and use it in GitHub Desktop.
#!/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