A. Before You Start
Now is a good time to make sure you've turned in what you think you turned in.
- Use the Scores tab of the course website to check that you have submissions for everything at the times you expect.
To make sure that your local machine has all tags in the central repository, run:
git fetch origin
To see what tags you have, run:
If you have a tag (say
hw1-2), then the command
git log -1 hw1-2 # That's a one, not the letter 'l'
will print the log message for that tag, which has a date and time.
- You can match up tags with [Scores] submissions by date.
- Note: Run
git statusto see which files are ones you created and never bothered to track, listed under "Untracked files". These files aren't being tracked by git yet, and thus aren't part of ANY submission.
After making sure that you've committed all current work in your local repository, you can check out any tagged submission (say,
git checkout hw1-2
It will tell you that you are in "detached head state". Despite sounding sinister, that's actually quite normal. Detached head means that your git repository is no longer at the latest commit, or "head", of your master branch (or any branch, for that matter).
Checking out a tag will allow you to see the exact files you submitted for that tag. Open any file, and you can see the state of that file for that specific submission.
IMPORTANT: When you're finished looking around in "detached head" state, you can run
git checkout master
to go back to the master branch. This is important because if you start modifying, adding, and committing files while your head is detached, you'll end up with a very messy git repo that will need some cleaning up.
Let's clean up any untracked files that we don't care about. Run
If you don't see a section called "Untracked files", skip this step. Otherwise, look through the list of untracked files. You may notice files
outunder some of your lab and homework directories. There are some files that you don't need to submit to the autograder for labs, homeworks, and projects, but show up in your repository anyways. As the semester continues, this list of "Untracked files" that we don't care about may get longer, and this makes running
git statusa bit annoying. Let's clean that up now.
In the root of your git repository, ie. the repo folder, open the
.gitignorefile if it exists, and create it if it doesn't with
As the name implies, this file contains the names of files that we want git to ignore. Add the untracked files that you don't want git to keep track of in this file, one per line. For example, any
.DS_Storefile or file ending with
.imlcan be safely added to the
.gitignore, along with any
.ideafolders. You may have other files that you want git to ignore too -- feel free to add them, or ask a lab assistant/TA if you're unsure.
.gitignoreallows you to pattern match files. This is helpful if you have lots of similarly-named files that you want to ignore. For example,
*.imltells git to ignore all files that end with
.iml, in all subdirectories.
When you're done, add and commit this
.gitignorefile just like any other file, that we DO want git to keep track of.
We'll start by reviewing pointers, arrays, and OOP. Complete these four interactive exercises:
C. Project 0
Hopefully you've made some good progress on Project 0, which is due Monday, September 23. The rest of the lab is for you to work on the project. A couple of pointers:
- Make sure you understand the rules of the game. If you have questions, first reread the spec here!
- If you have questions, feel free to post on Piazza. Make sure to search to see if your question has already been asked before asking!
- Code with good style! Make sure to run
make styleon the necessary files.
In order to receive credit for this lab, you must attempt all exercises in Section B. There is nothing to submit through git for this lab. Good luck with the project!