Saturday, August 9, 2014

Git Tips: Refreshing Source Code from the Origin (upstream source)

git-scm: quick tips for your reference

I sourced this one from the blog, Gitready: fetching upstream changes.

This tip comes from Dav Glass, whose work on YUI at GitHub requires him to bring in commits frequently. So, he’s created a helpful alias so he can merge in changes easily.

First off, he’s got a consistent naming scheme for his upstream remote:

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


Just throw this in your
.gitconfig

and you’re all set:


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


Now
git pu

will grab all of the latest changes from both remotes, and then merge in the commits from upstream.

Post a Comment