61B Assignment Workflow
Author: Ethan Ordentlich
This guide describes how to set up an assignment in CS 61B.
Here is a video demo of this guide:
If you get some sort of error, stop and either figure it out by carefully reading the Git WTFs or seek help at office hours or on Ed. You’ll potentially save yourself a lot of trouble vs. guess-and-check with git commands. If you find yourself trying to use commands recommended by Google like force push
, don’t run them, even if a post you found on Stack Overflow says to do it!
Getting the Skeleton
The skeleton
remote repository contains the skeleton code for all assignments. Whenever a new assignment is released, or if we need to update an assignment, you will pull from the skeleton. First use cd
to navigate to your fa25-s12345
repository directory, then run:
git pull skeleton main
This fetches all remote files from the repo named skeleton
(which is located at https://github.com/Berkeley-CS61B/skeleton-fa25.git
) and copies them into your current folder.
If you get an error similar to fatal: refusing to merge unrelated histories
, you can fix this each time by using
git pull --no-rebase --allow-unrelated-histories skeleton main
Opening in IntelliJ
The following instructions apply for every assignment. For every assignment, after pulling from skeleton
to get new lab or project files, you will need to run through the following steps again.
-
Start up IntelliJ. If you have no projects open, click the “Open” button. If you have a project currently open, navigate to “File –> Open”.
-
Find and choose the directory of your current assignment. For example, for Homework 1, you would select the
hw01
directory inside yourfa25-s12345
repo.Make sure that you open only the assignment folder, and not the entire
fa25-s12345
repo. -
Navigate to the “File -> Project Structure” menu, and make sure you are in the Project tab. Set your project SDK to your installed Java version. If 21 or higher isn’t available in the dropdown, make sure you downloaded and installed Java completely.
-
Still in the Project tab, set the Project Language Level to “SDK default”.
At this point, the Project tab should look something like this:
- The SDK is set to Java 21 or higher.
- The Language level is “SDK default.”
- The Compiler output is filled in, and is set to the assignment directory, followed by
out
-
Still in Project Structure, go to the Libraries tab. Click the “+ -> Java” button, then navigate to
library-fa25
, select the folder, and click “Ok”. -
Click “Ok” to apply your settings and leave Project Structure.
At this point, if things have been configured correctly:
- Each Java file should have a blue circle next to its name.
- When you open any file, none of the code should be highlighted in red.
Submitting to Gradescope
-
Use
cd
to navigate to your repository, and add your assignment directory usinggit add
.For example, for Homework 1, you can use
cd
to navigate tofa25-s12345
, then rungit add hw01
.Or, you could use
cd
to navigate tofa25-s12345/hw01
, and then rungit add .
(where.
is shorthand for “the current folder”). -
Commit the files using
git commit -m "<commit message here>"
. The commit message is required.For example,
git commit -m "Finished Homework 1"
. - Push your code to your remote repository with
git push origin main
. -
Open the assignment on Gradescope. Select Github, then your
fa25-s12345
repository and themain
branch, then submit your assignment. You will receive a confirmation email, and the autograder will run automatically.If Gradescope doesn’t let you choose the correct repository/branch, try unlinking and relinking your GitHub account.
Gradescope will use the latest version of your code from Github. If you think that Gradescope isn’t grading the right code, check that you have added, committed, and pushed by running git status
.
If you’ve gotten yourself into a situation where you’re unable to push for some reason, see Git WTFS.