Skip to content

Contribute to BrainGrid open source project

Jewel edited this page Sep 29, 2017 · 2 revisions

1. Fork and clone BrainGrid

First, if you are new to Github, get your Github account ready and follow the below steps to download BrianGrid. You can also go over our Git Crash Course for some useful tips.

  1. To fork a repo, navigate to the BrianGrid Github page and click on the Fork button

  2. Open terminal and go to the directory you plan to have BrainGrid placed. For example, you can place it under your home directory $ cd ~

    $ cd YOUR_PREFERED_PATH
  3. To clone the forked repo to your local machine: How

    $ git clone https://github.com/YOUR_USERNAME/BrainGrid.git

Now that you have the entire BrainGrid repository, including all open branches. By default you will be on the master branch which is the most recent version (might be unstable). If you are a user, this should be the right branch for you. If you are a collaborator and wish to work on specific part of the BrainGrid, check out to your desired branch or create a new branch.

2. Keep your forked BrainGrid in sync

If you are forking the BrainGrid that is currently under development, you will want to sync your forked repo with our original repo from time to time to keep it up-to-date (Why). Here is how to set up origin & upstream to keep your forked repo in sync:

  • List the current configured remote repository for your fork.

    When a repo is cloned, the default remote origin is your fork on Github, not BrainGrid repo it was forked from.

    $ git remote -v 
    origin  https://github.com/YOUR_USERNAME/public_html.git (fetch)
    origin  https://github.com/YOUR_USERNAME/public_html.git (push)
  • Set BrainGrid as your new remote upstream in order to keep your local copy in sync with the BrainGrid.

    $ git remote add upstream https://github.com/UWB-Biocomputing/BrainGrid.git
  • Verify the new remote repository you've specified for your fork.

    $ git remote -v
    origin  https://github.com/YOUR_USERNAME/BrainGrid.git (fetch)
    origin  https://github.com/YOUR_USERNAME/BrainGrid.git (push)
    upstream        https://github.com/UWB-Biocomputing/BrainGrid.git (fetch)
    upstream        https://github.com/UWB-Biocomputing/BrainGrid.git (push)

    if you want to see more detail, do:

    $ git remote show origin
    $ git remote show upstream
  • Syncing your fork by fetching from upstream BrainGrid repo: How

    $ git fetch upstream

    Merge the changes from upstream/master into your local master branch

    $ git checkout master
    $ git merge upstream/master

Now your fork's master branch is in sync with the latest BrainGrid repo without losing your local changes. You are now all set to use BrainGrid.

3. Contribute to BrainGrid

If you want to make changes and contribute to BrainGrid, we strongly recommend creating new branches on your end. This would make it easier for us to track changes and collaborate with other people.

  1. List all branches in the repo

    $ git branch
    
  2. Create a new branch to work on Why

    $ git checkout -b YOUR_BRANCH_NAME [BASE_BRANCH_NAME]
    

    (Note: BASE_BRANCH_NAME is optional and defaults to master)

  3. Commit and push the changes you made locally to your own Github repository

    $ git status
    $ git add FILE_NAME
    $ git commit -m “MESSAGE”
    $ git push -u origin YOUR_BRANCH_NAME
    
  4. Open a pull request when you are ready to let us know about the changes you've pushed to your repo on Github: How

  • Go to your forked BrainGrid repo page on GitHub.
  • Click on Pull Request button in the repo header
  • Click on the Head Branch dropdown and pick the branch you wish to merge with.
  • Enter the title and description for your pull request.
  • Lastly, click on the green Send pull request button.
  • Once a pull request is sent, collaborators can review and discuss the changes you made.