Reference Materials

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-2024-spring-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-2024-spring-USERNAME.git Cloning into 'csci-e-92-2024-spring-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

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 main Your branch is up-to-date with 'origin/main'. 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 main Your branch is up-to-date with 'origin/main'. 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 main Your branch is up-to-date with 'origin/main'. 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 main Your branch is up-to-date with 'origin/main'. 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 main Your branch is up-to-date with 'origin/main'. 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 main Your branch is up-to-date with 'origin/main'. 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' [main 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. 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'
  2. 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-2024-spring-USERNAME.git * [new branch] problem-set-1 -> problem-set-1
  3. 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".

  4. 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.'

  5. Review the checklist - ensure you complete each of the items. Once, you are satisfied 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 @stbenjam @dwillens Please grade this

Update a problem set solution (before merging 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' [main 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-2024-spring-USERNAME.git 4ba6970..18a22ca problem-set-1 -> problem-set-1

Update a problem set solution (after merging pull request)

  1. If you are making small corrections, please open another pull request and comment on the original stating what you changed and link to the new one. If you are making substantial corrections or starting over, please reach out to us for assistance.