Until today, when working in a local clone of a GitHub fork of mine, I always used
git merge upstream/master to keep my clone up to date.
However, it seems there were times I should have been using
git rebase upstream/master. Git’s docs are not too helpful for me, unfortunately:
You can take the patch of the change that was introduced in C3 and reapply it on top of C4. In Git, this is called rebasing. With the rebase command, you can take all the changes that were committed on one branch and replay them on another one.
It seems I should be using
merge in most cases, but use
rebase when working in a branch, and wanting to apply remote changes to my branch before I merge it into master (or send a pull request). I’ll play a bit with this, and see if I understood things correctly!
And if you’re working with GitHub like me, you might enjoy this post, that will guide you through the steps to follow to rebase a branch that you used to submit a Pull Request on GitHub.