eZ Community » Blogs » Virgil Ciobanu » How to syncronize your github fork...

By

How to syncronize your github fork with "original" repository

Saturday 19 November 2011 4:55:52 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

When we create a fork of a repository on github.com our fork is just a standalone copy of the original repository as it was at that moment when we "forked". Many of us, especially at beginning of using git, expect somehow that our fork to be "in sync" with the original repo which is not the case.

For those of you who are not interested or not have time to invest learning git I put together in this post the minimal steps you need to do to synchronize your fork with original repository.

synchronize = getting the commits that where pushed on the original repository between the moment of fork (or last sync) to date into your fork

In case you also wonder what's the purpose of a fork my answer(not very well documented) is: to permit pull requests.

Assumptions: you have git installed on you computer, being able to use it from command line and you have the github authentication setup so that you are able to push commits into your fork (if not see this).

 

For those in rush bellow you have the sequence of commands that will do the job, only replace <your-gh-name> with you github name:

 

1) git clone git@github.com:<your-gh-name>/ezpublish.git ezforksync

2) cd ezforksync

3) git remote add upstream https://github.com/ezsystems/ezpublish.git

4)  git pull upstream master

5) git push

Steps explained a bit:

1. Clone your fork repository on your PC. Github ofer you 3 URL to your fork, you need to use one of those writable, I choose the ssh one.

2. Go in newly created folder that contains your copy of repository so that next git commands will work

3. Add a "remote" named upstream (name doesn't matter) that points to ezsystems/ezpublish repo

4. Fetch all missing comits from the remote repo and merge them into your local branch (master)

5. Push all new commits that where got from upstream into your fork

That's all, comments are welcomed.

Proudly Developed with from