There is a common set of Git actions I regularly do when a feature branch has gone out of date with its master branch (or whatever branch I’m basing from). The way I would update the feature branch would be to checkout the master branch, fetch updates, checkout my feature branch again and lastly rebase from the master branch.
At some point I discovered that there is a way to shorten this dance back and forth. Here is what you can do instead and what I do now.
git fetch origin master:master
The command above replaces the steps of switching from my current feature branch to master, pulling the new changes, and switching back branches again. Now the master branch is up to date and we can rebase to update our feature branch without getting any ugly merge commit.