git remaster

Posted on March 19, 2019 · 1 min read

I sometimes work across multiple branches for a variety of reasons, but usually when breaking up larger changes into smaller chunks. Sometimes I want to rebase these smaller chunks on my master branch. This usually results in the following series of commands:

git checkout master
git pull
git checkout <branch>
git rebase master

A fellow Stripe pointed out a convenient way to get the latest changes onto the master branch. It involves setting up a git alias:

git config --global alias.remaster 'fetch origin master:master'

This alias will update my local master branch with the latest changes from the remote repository, without my having to checkout the master branch locally. Now I can rebase a bit more quickly:

git remaster
git rebase master