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.
- 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.
- Add your changes by running
git add <file to add>
. You can also use a pattern instead of filenames, likegit 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.
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.
- 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.
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.
- Push your changes to the origin repository (your personal GitHub Classroom repository) using
git push origin <branch, typically master/main>
. You can omitorigin <branch>
, but it is good practice to specify it to cement the idea thatgit push
will update a specific branch of the origin repository.
- 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
- Navigate to your repository on GitHub to verify that your changes have been properly pushed.
- Once you are satisfied with the state of your repository, navigate to the CS 1230 course on Gradescope.
- Click on the assignment you'd like to hand in.
- 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.
If your account is already connected, your submission window should look like this...
- Click Select a repository and select the project repository that you want to submit.
- Select the branch you'd like to hand in. In most cases, this will be
master
ormain
.
- Click Upload to complete your submission.
- You have successfully submitted your assignment! You should see a confirmation message and email.
- If your project has successfully compiled, you should see something like this!
- If something has gone wrong, you will see something like this :(