view live at: www.common--room.com
- Make sure you aren't behind the remote branch.
git pull origin master --rebase
- If you get merge conflicts, your editor/IDE might have a tool to visually resolve them. Webstorm does and it's really useful. Once resolved, commit your changes with a random commit message, it will be undone in a bit.
- Make your changes locally. When you're ready to test them, create a local commit. The message will only be read by you so it doesn't matter too much
git push -f heroku master
- The -f flag forces your working copy to be uploaded exactly to the heroku repo. It's dangerous in theory because you're ignoring any changes that are in the remote branch but not in your local copy, but we don't care in this case because heroku is not the repo that we use to actually maintain our code, origin is. We're just using heroku to host.
- Test your changes with as many commits as necessary to ensure it is working.
When you have confirmed your changes are working and you're ready to check them in, the following steps will squash all of the micro-commits that were likely necessary when testing with heroku into one commit in the origin repo that is more readable and solves a problem as a single commit.
git log --oneline
- Copy the commit ID of the last commit that was pushed to the remote branch
git reset --soft <commitID>
git add *
git commit
: Don't use the-m
flag. Take a minute to write a detailed commit message explaining the problem you were solving, the solution you came to, anything else about your code change that would be useful for the team to know.git push origin master
Das it.
- This workflow largely eliminates the need for working on a branch other than master, but it would work similarly if you were working on a different branch, just replace the word master in all steps except for the heroku push step with the branch you're on.
- Eventually, we'll have a separate heroku staging environment that we'll be able to push to without messing with the prod one but no need yet
- To clear heroku cache:
heroku repo:purge_cache -a facemix