Skip to content

Using Git And GitHub

Ethan Smith edited this page Jul 18, 2017 · 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 <branch-name>
    
  • 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 <branch-name>
    
  • 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:

Git tutorials for svn users:

General git information:

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

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