Here’s a helpful tip from Dav Glass, who frequently pulls in commits for his work on YUI at GitHub. To streamline the process, he’s devised a handy alias for merging changes effortlessly.

Firstly, he maintains a consistent naming convention for his upstream remote:

git remote add upstream git://github.com/user/repo.git

Simply add this to your .gitconfig file:

[alias]
pu = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master"

Now, running git pu will fetch the latest changes from both remotes and merge the commits from upstream.

But how does this differ from git pull upstream master? Well, it fetches changes from two sources: his fork and the main repository (upstream). A regular pull usually only incorporates changes from one source. If you’re curious about the mechanics, check out the History section of Git for Computer Scientists for visual representations of the fetching and merging process.

Of course, there are various approaches to tackling this issue. For instance, you could opt for rebase or pull with rebase instead of merging. It all boils down to how you prefer to structure your repository’s history and what works best for you.

If you have any aliases or suggestions to streamline this process further, feel free to share them with us!