Last Updated: February 25, 2016
· rob wierzbowski

Simple workflow to keep forked Git repos up to date

When you're contributing to projects on Github you often want to pull updates from the original repo, then push changes to a forked repo on your own Github account. Code, lather, repeat. A shell extension called Hub makes this easy.

This is a quick reminder of the workflow once you've gotten used to what Hub does behind the scenes.

OK, on to the notes. These assume that you've aliased 'hub' to 'git', as the docs recommend.

  • Clone a remote project on gitgub

git clone githubuser/projectname
cd project_name</code></pre>

Create forked repo on your github account. fork also adds a new git remote named your_github_username 

git fork</code></pre>

Create a branch, do some work.
Push your feature branch to your github repo

git push -u yourgithubaccount yourfeaturebranch</code></pre> 

In the future you can git pull origin (probably with the --rebase flag) to get updates from the original project, and git some_command your_github_account to interact with your forked version. Short, simple, and consistant. Sweet!