Skip to content

Instantly share code, notes, and snippets.

@ianterrell
Created March 3, 2011 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianterrell/852892 to your computer and use it in GitHub Desktop.
Save ianterrell/852892 to your computer and use it in GitHub Desktop.
Small script to
#!/usr/bin/env ruby
# Usage:
# gitdb copy
# Copies the current development database into db/branchname-development.sqlite3
# gitdb
# Copies the db/branchname-development.sqlite3 into the default db/development.sqlite3
branch = `git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'`.gsub('* ','').strip
if ARGV[0] == "copy"
`cp db/development.sqlite3 db/#{branch}-development.sqlite3`
else
`cp db/#{branch}-development.sqlite3 db/development.sqlite3`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment