I've recently forked a couple of projects on github. One for some local Hacktoberfest experimentation and the other to poke around a bit with SmartThings device handlers. If I look at the repos on my github account, they report as some number of commits behind the project they were forked from.

Let's look at the current state of things:

$ git remote -v
origin  git@github.com:mysupersecretusername/SmartThingsPublic.git (fetch)
origin  git@github.com:mysupersecretusername/SmartThingsPublic.git (push)

Now, let's add a remote upstream:

$ git remote add upstream git@github.com:SmartThingsCommunity/SmartThingsPublic.git

Look at it again:

$ git remote -v
origin  git@github.com:mysupersecretusername/SmartThingsPublic.git (fetch)
origin  git@github.com:mysupersecretusername/SmartThingsPublic.git (push)
upstream    git@github.com:SmartThingsCommunity/SmartThingsPublic.git (fetch)
upstream    git@github.com:SmartThingsCommunity/SmartThingsPublic.git (push)

Now, we just need to update. I don't have any local changes or commits, so this part is trivial at the moment:

$ git fetch upstream
$ git merge upstream/master
$ git push

Boom! Everything is up-to-date.

Previous Post Next Post