Github + Gradescope Guide

This doc covers how to update your local changes to your Github repo and how to turn in your Github repo as an assignment through Gradescope. Note that GitHub has updated their terminology and that the master branch has been renamed to the main branch, but its function is unchanged.

Tracking and Pushing changes

Let's say you've edited your source code and now want to track the changes you've made. For example, maybe you edited main.cpp.

  1. Check the status of your repository by running git status in the repository directory. You should see a bunch of files marked as not staged for commit. In our case, we only edited main.cpp, so that should be the only file listed here.
Figure 1: The status of the repository before adding changes
  1. Add your changes by running git add <file to add>. You can also use a pattern instead of filenames, like git add *.cpp to add all C++ source files. You can check the status of your repository again to verify that all changes you want to track have been added.
Figure 2: Adding the changes and checking the the repository status again

You should be tracking changes often enough that you shouldn't have many files to add. If you choose to use git add -A which adds all changes at once, be sure to always check which group of files will be added in order to prevent unintended files from being tracked in the repository.

  1. Once all files have been added, you can commit your changes to the branch you are currently working on (for most people, this will be the main/master branch). Run git commit -m <commit message> with a short, informative message to add all tracked changes to the repository's history, also known as the tree.
Figure 3: Making a commit

If you forget to add the -m flag and get stuck on a vim page after running just git commit, you can quit the page by running :q! to return to the terminal and retry committing.

  1. Push your changes to the origin repository (your personal GitHub Classroom repository) using git push origin <branch, typically master/main>. You can omit origin <branch>, but it is good practice to specify it to cement the idea that git push will update a specific branch of the origin repository.
Figure 4: Pushing to origin. The -v flag just makes the output verbose and doesn't need to be included.
  1. Commit (and push) your changes often! This will allow you to go back to working versions of your code if you have accidentally changed something and broken your functionality. GitHub also acts as a relatively reliable external backup for your code if for some reason your computer stops working.

For more information about GitHub, see our GitHub Guide.

Handing in Assignments

  1. Navigate to your repository on GitHub to verify that your changes have been properly pushed.
  2. Once you are satisfied with the state of your repository, navigate to the CS 1230 course on Gradescope.
Figure 5: CS 1230 on Gradescope
  1. Click on the assignment you'd like to hand in.
Figure 6: An Assignment on Gradescope
  1. Navigate to the GitHub option on the popup submission window. Connect your GitHub account if you haven't already by clicking Connect to GitHub and following the prompts to connect.
Figure 7: Connecting GitHub to Gradescope
If your account is already connected, your submission window should look like this...
Figure 8: Connected Gradescope submission window
  1. Click Select a repository and select the project repository that you want to submit.
Figure 9: Specifying which repository to submit
  1. Select the branch you'd like to hand in. In most cases, this will be master or main.
Figure 10: Specifying which branch to submit
  1. Click Upload to complete your submission.
Figure 11: Uploading a Submission
  1. You have successfully submitted your assignment! You should see a confirmation message and email.
Figure 12: Confirmation message
  1. If your project has successfully compiled, you should see something like this!
Figure 13: Compilation Success Message
  1. If something has gone wrong, you will see something like this :(
Figure 14: Compilation Failure Message