Skip to content

How to contribute code using Github

thijs edited this page Oct 20, 2015 · 60 revisions

This page describes how you can contribute code to the Hydrogen project using Github

  1. goto github.com
  1. clone the hydrogen repo :
  1. clone the code from your Github repo to your PC
  • on your github repo page you will see a 'SSH clone URL' box : clone URL

  • copy the URL using the clipboard icon next to it

  • on your pc create a directory that will hold your local repo

  • open a terminal and cd to the directory you just created

  • now enter 'git clone [email protected]:thijz/hydrogen.git' :

    $ git clone [email protected]:thijz/hydrogen.git
    Cloning into 'hydrogen'...
    remote: Counting objects: 28218, done.
    remote: Compressing objects: 100% (16/16), done.
    remote: Total 28218 (delta 8), reused 0 (delta 0), pack-reused 28202
    Receiving objects: 100% (28218/28218), 15.39 MiB | 2.94 MiB/s, done.
    Resolving deltas: 100% (19189/19189), done.
  • cd to the new Hydrogen subdir that was created and check the git status with 'git status' :
    me@mypc:~/Git/Hydrogen/thijz$ cd hydrogen
    me@mypc:~/Git/Hydrogen/thijz/hydrogen$ git status
    # On branch master
    nothing to commit (working directory clean)
  1. build hydrogen (see this wiki page)

  2. fix a bug or create your own new Hydrogen feature

  3. build hydrogen and test your new feature

  4. commit your changes

  • using the 'git status' command you can see what files have been modified :
    me@mypc:~/Git/Hydrogen/thijz/hydrogen$ git status
    # On branch master
    # Your branch is behind 'origin/master' by 1 commits, and can be fast-forwarded.
    #
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #	modified:   src/gui/src/SongEditor/SongEditorPanelTagWidget_UI.ui
    #
    no changes added to commit (use "git add" and/or "git commit -a")
  • first you will have to add these files to your local repo using 'git add' :
   me@mypc:~/Git/Hydrogen/thijz/hydrogen$ git add src/gui/src/SongEditor/SongEditorPanelTagWidget_UI.ui
  • now lets check the git status again using 'git status' :
   me@mypc:~/Git/Hydrogen/thijz/hydrogen$ git status
   # On branch master
   # Changes to be committed:
   #   (use "git reset HEAD <file>..." to unstage)
   #
   #	modified:   src/gui/src/SongEditor/SongEditorPanelTagWidget_UI.ui
   #

as you can see the file has been added to the repo but this addition still needs to be committed with the 'git commit -m "my comment"' command :

    me@mypc:~/Git/Hydrogen/thijz/hydrogen$ git commit -m "set the tag column header to stretch over the whole window"
    [master 625945a] set the tag column header to stretch over the whole window
     Committer: tvanseve <tvanseve@tvanseve-ThinkPad-W530.(none)>
    Your name and email address were configured automatically based
    on your username and hostname. Please check that they are accurate.
    You can suppress this message by setting them explicitly:

        git config --global user.name "Your Name"
        git config --global user.email [email protected]

    After doing this, you may fix the identity used for this commit with:

        git commit --amend --reset-author
  1. push the changes from your local repo (on your PC) to your remote github repo (on the Github server) using 'git push' :
    me@mypc:~/Git/Hydrogen/thijz/hydrogen$ git push
    Counting objects: 13, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (7/7), done.
    Writing objects: 100% (7/7), 713 bytes, done.
    Total 7 (delta 5), reused 0 (delta 0)
    To [email protected]:thijz/hydrogen.git
       71e9ed5..625945a  master -> master
  1. verify that your new commit is now available in your github repo:

check your commit

  1. create a pull request Your code has now been uploaded to your Github repo, but it has not been merged into the main Hydrogen repo. To do this you need to make a 'pull request'. A pull request is basically asking the Hydrogen Github repo responsible to have a look at the code you created (or modified) and (if your work looks good) merge it into the Hydrogen repo.

compare changes