Tuesday, September 25, 2012

Forking a git repo

Forking a git repo allows you to edit someone else's code and implement awesome ideas and in turn share those ideas with the developer community out there.

So basically forking a git repo is like moving a repo from someone elses account to your account but still maintaining links to the other repo if desired. So you can still update your fork so that it is in sync with the main author's code.

To get started
  • Go to git and for the repo you want
  • Clone the repo git clone url
  • Keep track with original code by setting the upstream url git remote add upstream originalRepoUrl. You still have references to your own origin
  • Pulls in changes not present in your local repository, without modifying your files by running git fetch upstream
  • To the merge in the changes to a local branch git checkout master; git merge upstream/master

No comments:

Post a Comment