A03.FirstGit
This activity is designed to give you practice working with a single branch within a local Git repository. By
the end of this activity, you should be able to both inspect the history of past versions within a single
branch, and also make new changes of your own to extend this history.
Table of Contents
1. Setup FirstGit Activity
2. Inspect the History of this Repository
3. Extend the History of this Repository
4. Submit Work
1. Setup FirstGit Activity
1. Run the cs400 get command, and choose A03.FirstGit from the menu to download a folder named
A03.FirstGit containing the starter files for this assignment, and navigate into this folder to complete
this activity.
2. While working through this activity, it is important for your commit message to exactly match what is
in quotes below (omitting the quotes themselves). There should be no newlines in your message. If
you make any mistakes or ever want to restart this activity you can do so with the “cs400 restart”
command. This will not erase your previous commits, but instead create a new one with the state of
your files from the beginning of this assignment. When grading we’ll only every look for and grade
you most recent commits with the exact messages described below.
Note: The first line of each commit message is called its subject, which briefly describes what’s included
in this commit. Detailed explanation of the commit should start from the third line, seperated from the
subject by a blank line. In this activity, we don’t need detailed explanation on the commits, so only the
subject line is required.
2. Inspect the History of this Repository
1. Find the commit within the history of this repository that contains the commit message “Joke
Explanation”, and review the contents of the explanation.txt file within this commit. This file contains
references to some wikipedia pages that help explain the origins of the joke below.
2. Next, find the commit within the history of this repository that contains the commit message “Joke
Answer”, and review the contents of the answer.txt file within this commit. In fact, copy the contents
of this file to your clipboard, for use in the following step.
3. Extend the History of this Repository
1. Return to the head of the main branch within your repository, and then edit the Main.java file there.
Within the body of the main method, add a second print statement that prints exactly the text the from
within the answer.txt file that you retrieved in the last step.
2. Use git status to confirm that your edits are not yet a part of a tracked commit, before you: Create
a new commit with the message “Joke Program Complete” that incudes the edit you just made.
Use git status again to confirm that these edits are now saved as the most recent commit, and
use git log to confirm that your commit and commit message are displayed.
3. Compile and run this java program from the command line. Use git status to confirm that the new
.class file you just created is being displayed as an untracked change. Since we don’t want to track
changes to this file, define a new .gitignore file to hide this from the output of git status . Note that
since this .gitignore is not ignoring itself, the git status message should continue to reflect that this
file is new and untracked through step 5 below.
4. Next add the following class header to the top of your Main.java source file. Replace the
and with your own name and netid (note that your netid usually precedes "@wisc.edu"
unless you have setup a different vanity account name for this.
/**
* Main class for CS400 A03.FirstGit activity Spring - 2024
* @author: ,
**/
5. Ensure that your Main.java program continues to compile and run before making a new commit with
these changes (and your new .gitignore file). Make the message for this commit “Added Header
Comment and .gitignore”.
4. Submit Work
1. From directly within the A03.FirstGit folder, run the cs400 submit command. Note: Do not worry
about the "No stash entries found" message that you are likely to see when running this command: it
is not a sign of any problems with your submission. You should instead check that your work was
correctly submitted as follows:
2. Check whether your submission successfully transferred to gitlab and also whether it passed our pregrading correctness scans by running the cs400 script with the check argument as follows: cs400
check You may need to wait a minute or two before the scan finishes to get the feedback you are
interested in from his command.
3. Another way that you can check the contents of your most recent submission is to log into DoIT’s
gitlab instance (https://git.doit.wisc.edu/) (using the UW-Madison NetID button at the bottom of the
page), and navigate through the contents of your submission within your A03.FirstGit project there.
Note that changes made through this web interface will not be registered as a submission, and that
you’ll need to run the cs400 submit command to submit changes that can be graded for this reason.