Skip to content

Instantly share code, notes, and snippets.

@tjmcewan
Last active December 19, 2015 06:59
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 tjmcewan/5915657 to your computer and use it in GitHub Desktop.
Save tjmcewan/5915657 to your computer and use it in GitHub Desktop.
multi-stage deploy using git rebase -i
# x (or exec) will run anything on the same line as a shell command.
# we need to checkout a temporary branch because git won't push detached HEADs.
# after deploy, the "checkout -" means checkout the previously checked out thing,
# which will go back to our detached head and we clean up the temporary branch so
# that we don't need to worry about merging.
# if your branch is already based on the same point as your rebase command, then
# the 'pick' stage is essentially the same as a fast-forward merge; no new commits
# are created.
pick 0f85802 add missing timestamps
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 5f414c7 remove unused tables
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 8874c03 remove unused columns
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 6b770af delete orphaned records
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 0473a01 improve database schema
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 6d70686 update schema defaults
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick b076ece add immigrant gem
pick 4230e4c add foreign keys
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 8e64a2e add missing indexes
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
pick 620f59d remove one-time scripts
pick 1182d4e update code & fix tests
x git checkout -b temp && git push && cap deploy && git checkout - && git branch -d temp
@phantomwhale
Copy link

Ah, you got that exec command working for you then :)

@tjmcewan
Copy link
Author

tjmcewan commented Jul 3, 2013

Don't try this at home. 👊

@tjmcewan
Copy link
Author

tjmcewan commented Jul 3, 2013

@phantomwhale yerp. works alright. not sure if i'm actually going to do this though. I would recommend against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment