If you’re like me, your normal git workflow looks something like this:
- Do some work in a topic branch and need to rebase master into the branch.
git checkout mastergit pull origin master(orfetchandmerge)git checkout topic-branchgit rebase master
Once you’re done with your topic branch, it might look something like this:
git checkout mastergit merge topic-branchgit push origin master
That’s a lot of work, and as a developer we can definitely make that process easier. About 4 years ago, I came across a set of bash scripts that simplified this workflow greatly. The creator, Rein Henrichs, named them Hack && Ship.
These tools worked great, but weren’t flexible enough for me. They assumed that you would always be rebasing and pushing to the master branch. If this wasn’t the case, you had to do everything by hand.
Here are my updated versions of Hack && Ship that allow you to rebase and push to any branch (such as staging or qa):
Hack
Ship
To use them, create two files named hack and ship somewhere in your path (like /usr/local/bin maybe) and make them executable. Then, you can invoke them like so:
hack or hack staging
push or push qa
hack && ship