Skip to content

Instantly share code, notes, and snippets.

@40thieves
Last active May 30, 2019 10:51
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 40thieves/de74e20174288d2d985ee91d76da6550 to your computer and use it in GitHub Desktop.
Save 40thieves/de74e20174288d2d985ee91d76da6550 to your computer and use it in GitHub Desktop.
# Make sure you've got the latest as-coffee-base and master branches
$ git fetch
# Get set up with the branch you want to decaffeinate
$ git checkout <MY-BRANCH>
# Rebase it, so it's branched from the changes just before decaffeinating
$ git rebase origin/as-coffee-base
# Run the decaffeination on your branch. You need to be on a version of npm with `npx` available, which I think is default from at least Node 8 onwards. I did this on node 8.4.0 installed via nvm. I think you also need prettier installed in advance.
$ npm install -g prettier prettier-eslint
# The script also requires `zsh` to run, which can be installed via brew or apt.
$ ./decaffeinate.sh
# The script should have committed its changes, so you should have a clean working tree.
# Now checkout the commit just after the decaffeination was run on master:
$ git checkout 1aa7392511527db2a51546364c87efd291972eec
# Turn this commit into a branch which is going to become your new branch, since this is where we need to fork from:
$ git checkout -b <MY-BRANCH>-decaff
# Now update your local files with the content of your original branch, in its decaffeinated form:
$ git checkout <MY-BRANCH> -- .
# Check that this all looks sane (this should look like your changes from your branch, but all in ES6, rather than CS on the front-end.
$ git diff --cached
# Commit it! Sadly this will squash all your old branch history into one commit:
$ git commit -a -m "Decaff version of group plans purchasing"
# Delete the old branch (which isn't mergable)
$ git branch -D <MY-BRANCH>
# Replace the old branch with this amerceable, decaffeinated branch
$ git branch -m <MY-BRANCH>
# Rebase your decaf'd branch onto master (needed to fix a couple of linting issues in CI):
$ git rebase origin/master
# Push it up!
$ git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment