You are here : Home

Git instructions

Install Git
http://git-scm.com/book/en/Getting-Started-Installing-Git

Create a GitHub account [optional]

https://github.com/join

Clone GATE source code repository

GATE project on GitHub is the public repository of the GATE software.

If you want to get a copy of the GATE source code repository, the command you need is git clone.

If you’re familiar with other VCS systems such as Subversion, you’ll notice that the command is clone and not checkout. This is an important distinction — Git receives a copy of nearly all data that the server has. Every version of every file for the history of the project is pulled down when you run git clone. In fact, if your server disk gets corrupted, you can use any of the clones on any client to set the server back to the state it was in when it was cloned.

$ git clone https://github.com/OpenGATE/opengate.git

This command creates a directory named opengate, initializes a .git directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version. If you go into the new opengate directory, you’ll see the project files in there, ready to be worked on or used. If you want to clone the repository into a directory named something other than grit, you can specify that as the next command-line option:

$ git clone https://github.com/OpenGATE/opengate.git myrepository

That command does the same thing as the previous one, but the target directory is called myrepository.

Fork GATE repository

A fork is a copy of a repository

  • It lets any GitHub user make changes to a project without affecting the original repository
  • It can be used to fetch updates from or propose changes to the original repository

Rather than logging an issue for a bug you can:

  • Fork GATE repository
  • Make the fix
  • Submit a pull request to the OpenGATE collaborators so that they pull your work into the original GATE repository

Forking GATE repository is a two-step process:

  1. On GitHub, navigate to the OpenGATE/opengate repository
  2. In the top-right corner of the page, click Fork

Now you have a fork of the original OpenGATE/opengate repository

Keep your fork synced

Step 1: Set Up Git

  1. Open Terminal
  2. Tell Git your name so your commits will be properly labeled
    $ git config --global user.name "YOUR NAME"
  3. Tell Git the email address that will be associated with your Git commits.
    The email you specify should be the same one found in your email settings.
    $ git config --global user.email "YOUR EMAIL ADDRESS"

Step 2: Create a local clone of your fork

  1. On GitHub, navigate to your fork of the OpenGATE/opengate repository
  2. Under your repository name, click Clone or download
  3. In the Clone with HTTPs section, click to copy the clone URL for the repository
  4. Open Terminal, type $ git clone, and then paste the URL you copied in 3
    $ git clone https://github.com/YOUR-USERNAME/opengate.git
    Cloning into 'opengate'...
    remote: Counting objects: 20182, done.
    remote: Total 20182 (delta 0), reused 0 (delta 0), pack-reused 20182
    Receiving objects: 100% (20182/20182), 13.83 MiB | 3.24 MiB/s, done.
    Resolving deltas: 100% (13674/13674), done.

Now you have a local copy of your fork of the GATE repository

Step 3: Configure Git to sync your fork with the original GATE repository

  1. Change directories to the location of the fork you cloned in Step 2 and type git remote -v
    $ git remote -v
    origin https://github.com/YOUR_USERNAME/opengate.git (fetch)
    origin https://github.com/YOUR_USERNAME/opengate.git (push)
  2. Type git remote add upstream, and then paste the URL of the OpenGATE/opengate repository
    $ git remote add upstream https://github.com/OpenGATE/opengate.git
  3. To verify the new upstream repository you've specified for your fork, type git remote -v again
    $ git remote -v
    origin https://github.com/YOUR_USERNAME/opengate.git (fetch)
    origin https://github.com/YOUR_USERNAME/opengate.git (push)
    upstream https://github.com/OpenGATE/opengate.git (fetch)
    upstream https://github.com/OpenGATE/opengate.git (push)

Now, you can sync your fork with the upstream repository

  1. Fetch the branches and their respective commits from the upstream repository
    $ git fetch upstream
    remote: Counting objects : 75, done.
    remote: Compressing objects: 100% (53/53), done.
    remote: Total 62 (delta 27), reused 44 (delta 9)
    Unpacking objects: 100% (62/62), done.
    From https://github.com/OpenGATE/opengate.git
    * [new branch] master -> upstream/master
  2. Check out your fork's local develop branch
    $ git checkout develop
    Switched to branch‘ develop'
  3. Merge the changes from upstream/develop into your local develop branch
    $ git merge upstream/develop
    Updating a422352..5fdff0f
    Fast-forward
    README | 9 -------
    README.md | 7 ++++++
    2 files changed, 7 insertions(+), 9 deletions (-)
    delete mode 100644 README
    create mode 100644 README.md

Submit changes with pull requests

To contribute back to the original GATE repository, we recommend creating branches locally, on your computer

  1. Create a new branch within your repository
    $ git checkout –b branch mynewbranch
    Switched to a new branch “mynewbranch"
  2. Create or edit a file in your repository
  3. Push your changes on GitHub
    $ git push origin mynewbranch
    Username for 'https://github.com': yourusername
    Password for 'https://yourusername@github.com':
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 216 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To https://github.com/albertine/opengate.git
    * [new branch] mynewbranch -> mynewbranch
    Branch mynewbranch set up to track remote branch mynewbranch from origin.

Create a pull request so that OpenGATE collaborators can review the changes in your branch

  1. Navigate to the OpenGATE/opengate repository
  2. To the right of the branch picker, click New pull request
  3. On the Compare changes page, click compare across forks
  4. Select OpenGATE/opengate as the base fork. Use the base branch drop-down menu to select the branch you'd like to merge changes into
  5. Use the head fork drop-down menu to select your fork, then use the compare branch drop-down menu to select the branch you made your changes in.
  6. Type a title and description for your pull request
  7. Click Create pull request

After your pull request has been reviewed, your proposed changes can be merged into the OpenGATE/opengate repository.