Skip to content

Using Git And GitHub

Jukka Lehtosalo edited this page Apr 16, 2016 · 4 revisions

Using GitHub pull requests

Here is a suggested git workflow for contributing code changes:

  1. Set up Git on your computer (instructions).
  2. Create a GitHub account (unless you already have one).
  3. Navigate to https://www.github.com/python/mypy and "fork" the repository. This gives you a clone of the repo hosted at GitHub under your GitHub account.
  4. Clone a local copy of your own fork of the repository. This creates a directory mypy under the current working directory. For example:
$ git clone https://github.com/<your-account>/mypy.git
  1. Change the directory to the original cloned repo (mypy):
$ cd mypy
  • Create a new branch in the local mypy repo for your changes (replace with a descriptive but short name):

$ git checkout -b

 * Now commit some changes to your local copy of the repository.
 * Test your changes a bit and fix any bugs you find.
 * Push the changes to the repo hosted under your GitHub account:

$ git push -u origin

 * Send a pull request according to these instructions:
   https://help.github.com/articles/creating-a-pull-request
 * Now the mypy developers will review and merge your changes. This may take a few days (or more), depending on how busy the developers are.
 * You probably want to check out the master branch again before continuing from step 5 for another contribution:

$ git checkout master


## More information

The above description did not mention some important things such as how to fetch and merge changes from the main mypy repo. Read this for more information:

 * https://help.github.com/articles/fork-a-repo

Git tutorials for svn users:

 * https://git.wiki.kernel.org/index.php/GitSvnCrashCourse

General git information:

  * [Pro Git (online book)](http://git-scm.com/book)
  * [Introduction to git at GitHub](http://learn.github.com/p/intro.html)

More about branching in git (it's not like in Subversion):

  * http://learn.github.com/p/branching.html
  * http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging

Using hg to access git repositories (not verified; please edit this and add a comment if you try this):

 * http://hg-git.github.com/ 
 * http://mercurial.selenic.com/wiki/HgGit