Manuals:

Getting started with the sample code

Setup your GitHub Classroom repository

  1. You will need a GitHub account. If you already have one, you are able to use that. If not, sign up here.

  2. Accept the CSCI E-92 operating systems project, this will set up a repo on GitHub for you.

    Your repo will be visible at: https://github.com/CSCIE9X/csci-e-92-USERNAME, where USERNAME is your GitHub username.

Make a local clone of your repository

  1. Set up Git on your development machine.

  2. Generate a new SSH key, if you don't already have one you'd like to use with GitHub.

  3. Add the SSH key to your GitHub account.

  4. On your repository's main page, click the green "Clone or download" button and copy the "SSH" type URL. Use that URL from your command line to make a local clone.

    
    $ git clone git@github.com:CSCIE9X/csci-e-92-USERNAME.git
    Cloning into 'csci-e-92-username'...
    remote: Counting objects: 29, done.
    remote: Compressing objects: 100% (26/26), done.
    remote: Total 29 (delta 1), reused 0 (delta 0)
    Receiving objects: 100% (29/29), 22.27 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (1/1), done.
    Checking connectivity... done.
          
  5. Set up your author details.

    
    $ git config --global user.email example@g.harvard.edu
    $ git config --global user.name "Harvard Student"
    $ git config -l
    user.email=example@g.harvard.edu
    user.name=Harvard Student
          
  6. Add the course repository as a remote so that you can receive updates.

    
    $ cd csci-e-92-project
    $ git remote add course git@github.com:CSCIE9X/csci-e-92-project.git
    $ git remote -v
    course	git@github.com:CSCIE9X/csci-e-92-project.git (fetch)
    course	git@github.com:CSCIE9X/csci-e-92-project.git (push)
    origin	git@github.com:CSCIE9X/csci-e-92-USERNAME.git (fetch)
    origin	git@github.com:CSCIE9X/csci-e-92-USERNAME.git (push)
          

Workflows

Commit a change to your local repository

You should do this frequently, every time you get your code into a working state. For example, you could add a commit after adding a (few) new tokens or after refactoring.

Note: the files mentioned in these example workflows may not exist in your repository.

  1. Use git status to see what files you've changed since the last time you committed.

    
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    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:   doc/Questionnaire.txt
        modified:   src/fix-this-program.c
    
    no changes added to commit (use "git add" and/or "git commit -a")
          
  2. Use git diff to see the text of your changes.

    
    $ git diff
    diff --git a/doc/Questionnaire.txt b/doc/Questionnaire.txt
    index 275a313..3a6693d 100644
    --- a/doc/Questionnaire.txt
    +++ b/doc/Questionnaire.txt
    @@ -11,16 +11,16 @@
    -Name:                          Home/Cellular phone number: 
    +Name:  Harvard Student         Home/Cellular phone number: 414-555-1212
    
    -E-mail:                                Work phone number:
    +E-mail:        example@g.harvard.edu   Work phone number:
    
     If you're not in the Boston area, where are you located?  What is your
     time zone?
    -
    +       Milwaukee, WI, USA; CST (UTC-5)
    
     So that we can meet on-line, if necessary, what is your Skype name
     and/or your Google Hangouts name?
    -
    +       Skype: Student; Google Hangouts: example@g.harvard.edu
    
     Occupation (If an undergraduate student, please specify your major and
     year and at which school; If a graduate student, please specify your
    diff --git a/src/fix-this-program.c b/src/fix-this-program.c
    index 3ffb60b..d1e6e77 100644
    --- a/src/fix-this-program.c
    +++ b/src/fix-this-program.c
    @@ -86,6 +86,8 @@ int scan_only(FILE *output) {
         token_type = "op"; token_name = "RIGHT_PAREN"; break;
       case SEMICOLON:
         token_type = "op"; token_name = "SEMICOLON"; break;
    +  case EQUAL_EQUAL:
    +    token_type = "op"; token_name = "EQUAL_EQUAL"; break;
    
       case NUMBER:
         token_type = "num"; token_name = "NUMBER"; break;
          
  3. Use git add to stage changes for your commit. You can check which files have been staged with git status and what changes have been staged with git diff --cached. Only unstaged changes will be shown in a plain git diff.

    
    $ git add doc/Questionnaire.txt
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        modified:   doc/Questionnaire.txt
    
    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/fix-this-program.c
    
    $ git diff --cached
    diff --git a/doc/Questionnaire.txt b/doc/Questionnaire.txt
    index 275a313..3a6693d 100644
    --- a/doc/Questionnaire.txt
    +++ b/doc/Questionnaire.txt
    @@ -11,16 +11,16 @@
    -Name:                          Home/Cellular phone number:
    +Name:  Harvard Student         Home/Cellular phone number: 414-555-1212
    
    -E-mail:                                Work phone number:
    +E-mail:        example@g.harvard.edu   Work phone number:
    
    
     If you're not in the Boston area, where are you located?  What is your
     time zone?
    -
    +       Milwaukee, WI, USA; CST (UTC-5)
    
     So that we can meet on-line, if necessary, what is your Skype name
     and/or your Google Hangouts name?
    -
    +       Skype: Student; Google Hangouts: example@g.harvard.edu
    
     Occupation (If an undergraduate student, please specify your major and
     year and at which school; If a graduate student, please specify your
    $ git diff
    diff --git a/src/fix-this-program.c b/src/fix-this-program.c
    index 3ffb60b..d1e6e77 100644
    --- a/src/fix-this-program.c
    +++ b/src/fix-this-program.c
    @@ -86,6 +86,8 @@ int scan_only(FILE *output) {
         token_type = "op"; token_name = "RIGHT_PAREN"; break;
       case SEMICOLON:
         token_type = "op"; token_name = "SEMICOLON"; break;
    +  case EQUAL_EQUAL:
    +    token_type = "op"; token_name = "EQUAL_EQUAL"; break;
    
       case NUMBER:
         token_type = "num"; token_name = "NUMBER"; break;
    $ git add src/fix-this-program.c
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        modified:   doc/Questionnaire.txt
        modified:   src/fix-this-program.c
    
          
  4. Use git reset to unstage changed file, and git checkout to discard changes to a file.

    
    $ git add src/fix-this-program.c
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        modified:   doc/Questionnaire.txt
        modified:   src/fix-this-program.c
    
    $ git reset HEAD src/fix-this-program.c
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        modified:   doc/Questionnaire.txt
    
    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/fix-this-program.c
    
    $ git checkout -- src/fix-this-program.c
    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        modified:   doc/Questionnaire.txt
    
          
  5. Commit your staged changes with git commit. By default, it will open a text editor so that you can type a commit message. You can also provide a short commit message on the command line with the -m option.

    
    $ git commit -m'Completed questionnaire'
    [master e4cec33] Completed questionnaire
     1 file changed, 4 insertions(+), 4 deletions(-)
          
  6. Check the commit you just added with git show.

    
    $ git show
    commit e4cec336a248d60a6e7e7605c5b908d60188937e
    Author: Harvard Student <example@g.harvard.edu>
    Date:   Fri Feb 13 20:01:37 2015 -0500
    
        Completed questionnaire
    
    diff --git a/doc/Questionnaire.txt b/doc/Questionnaire.txt
    index 275a313..3a6693d 100644
    --- a/doc/Questionnaire.txt
    +++ b/doc/Questionnaire.txt
    @@ -11,16 +11,16 @@
    -Name:                          Home/Cellular phone number:
    +Name:  Harvard Student         Home/Cellular phone number: 414-555-1212
    
    -E-mail:                                Work phone number:
    +E-mail:        example@g.harvard.edu   Work phone number:
    
     If you're not in the Boston area, where are you located?  What is your
     time zone?
    -
    +       Milwaukee, WI, USA; CST (UTC-5)
    
     So that we can meet on-line, if necessary, what is your Skype name
     and/or your Google Hangouts name?
    -
    +       Skype: Student; Google Hangouts: example@g.harvard.edu
    
     Occupation (If an undergraduate student, please specify your major and
     year and at which school; If a graduate student, please specify your
          

Starting, finishing, and submitting a problem set solution.

  1. Before you start working on a problem set, check for updates from the course repository. You should do this each time before you start working on an assignment.

    
    $ git checkout master
    $ git fetch course
    remote: Counting objects: 62, done.
    remote: Compressing objects: 100% (57/57), done.
    remote: Total 62 (delta 18), reused 0 (delta 0)
    Unpacking objects: 100% (62/62), done.
    From git.github.com:/CSCIE9X/csci-e-92-project
     + 3c444a3...61a623b master     -> course/master
    
    $ git merge course/master
    Merge made by the 'recursive' strategy.
     assignments/ProblemSet1.txt | 3
      ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    $ git log -n 3
    commit c2bd8be1c7e3e289ca7495e1fab4522167f31671
    Merge: 28a8c4b 61a623b
    Author: Daniel Willenson <dwillenson@g.harvard.edu>
    Date:   Sun Jan 31 14:37:11 2016 -0500
    
        Merge remote-tracking branch 'origin/update-assignments'
    
    commit 61a623bf363fd9bae953a7d5dc705201af47c6b7
    Author: Daniel Willenson <dwillenson@g.harvard.edu>
    Date:   Sun Jan 31 14:33:18 2016 -0500
    
        Update Problem Set 1 assignment
    
    commit 28a8c4b0042a34766b6f68a9e1ee3784f417f15a
    Author: Harvard Student <example@g.harvard.edu>
    Date:   Fri Sep 4 20:01:37 2015 -0500
    
        Completed questionnaire
    
    $ git push origin master
  2. Then, create a branch called (for Problem Set 1) problem-set-1.

    $ git checkout -b problem-set-1
    Switched to a new branch 'problem-set-1'
  3. Work on the problem set. You should make commits frequently, every time you have your code in a reasonably good state, such as when it compiles and runs (even if it doesn't have completely correct behavior).

    You can push commits on your new branch to GitHub anytime.

    
    $ git push origin problem-set-1
    Counting objects: 3, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 309 bytes | 309.00 KiB/s, done.
    Total 3 (delta 1), reused 0 (delta 0)
    remote: Resolving deltas: 100% (1/1), completed with 1 local object.
    To github.com:CSCIE9X/csci-e-92-USERNAME.git
     * [new branch]      problem-set-1 -> problem-set-1
          
  4. When you finish Problem Set 1, push your branch, then visit your project page on GitHub where you will see a yellow bar that says "problem-set-1" - click the green link that says "Compare & pull request".

  5. Fill out the pull request template, however leave the checklist alone for now. However, ensure you have given the pull request a reasonable title like "Problem set 1". Then click 'Create pull request.'

  6. Review the checklist - ensure you complete each of the items. Once, you are satisified merge your pull request - do not wait for us to grade it. Add a comment to your pull request mentioning course staff to add it to the to-do list. Staff will leave comments on your pull request when grading. This may happen after you've already accepted the merge.

    @frankelharvard @massfords @stbenjam Please grade this

Update a problem set solution (before accepting pull request).

  1. You can continue to push commits to your branch after you've created the pull request, but before you accept it. The request will be updated with your new changes.

    
    $ git commit -m'Really finished Problem Set 1'
    [master 612ff91] Really finished Problem Set 1
     1 file changed, 3 insertions(+)
    
    $ git push origin problem-set-1
    Counting objects: 1, done.
    Writing objects: 100% (1/1), 186 bytes | 0 bytes/s, done.
    Total 1 (delta 0), reused 0 (delta 0)
    To git@git.github.com:CSCIE9X/csci-e-92-USERNAME.git
       4ba6970..18a22ca  problem-set-1 -> problem-set-1
          

Update a problem set solution (after accepting pull request).

  1. If you need to update a problem set solution after you've accepted the pull request, you must first push a branch marking the starting point.

    
    $ git branch problem-set-1-start c2bd8be1c7e3e289ca7495e1fab4522167f31671
    
    $ git push origin problem-set-1-start
    Counting objects: 1, done.
    Writing objects: 100% (1/1), 186 bytes | 0 bytes/s, done.
    Total 1 (delta 0), reused 0 (delta 0)
    To git@cr.cscie9x.net:example/csci-e-92-project.git
     * [new branch]      problem-set-1-start -> problem-set-1-start
            
  2. Create a pull request using your updated solution branch (e.g. problem-set-1) as the Source branch and the starting-point branch (e.g. problem-set-1-start) as the Target branch.

  3. Mention course staff on your review request. Close the pull request instead of accepting it.