Git for lab distribution/collection,
Basic linux/bash,
Binary, octal, hexadecimal representation of integers
Schedule:
In the labs of week 2 (Jan. 16) we'll introduce the git submit process and review some basic linux/bash commands.
The labs of week 3 (Jan. 23) we'll briefly recap the two's complement representations and operations we covered in the lectures.
The lab exercise is due at 5pm on Tuesday January 29th.
Reference material:
Lab exercises:
Open a command (terminal) window on the csci server (either using ssh or putty from your laptop, or using Applications -> System Tools -> MateTerminal on one of the lab workstations, and login to your csci account.
If you have taken this course previously, and you have a directory with your
old 162 work, rename it to ensure your old work doesn't get confused with this
year's work, e.g. to rename csci162 to old162:
mv csci162 old162 |
Create a directory for your csci 162 material, and cd into that directory:
mkdir csci162
cd csci162
You will follow this same process to obtain the collection of code for every lab this semester, just replacing lab1 in the instructions with lab2, lab3, etc.
At some point before the labs begin each week, on the csci git server the instructor will create the code/readme/files to be used for the lab, putting them all in a directory that has been configured for use with git (we'll refer to these directories as git repositories).
AFTER the instructor has done that, you'll be able to begin the steps below.
If your answers.txt file is missing: you most likely either
(a) tried to fork before the instructor released the material, (b) forgot to fork before cloning, or (c) made a mistake in the fork command but did the clone anyway. You can try the following fix:
|
Change directory into your lab1 (i.e. cd lab1) and then use your preferred editor to edit the answers.txt file. You'll see the file just has one line, saying "Put your name here". Replace that line with your name, save the file, and exit the editor.
We can see what git is keeping track of with the following command:
git status
If you run that command now, it should tell you there are untracked changes
in file answers.txt.
To tell git that you want it to keep track of your latest changes, we tell it which
file changes we want to make note of:
git add answers.txt
If we have created/altered multiple files, we could instead use a shorthand (essentially
telling it to keep track of all the changes we just made), using
git add . |
To commit our changes, we use git commit along with a message describing the changes, e.g.
git commit -m "Add my name to answers.txt"
(If we forget the -m and the message, git will open a default editor window
and expect us to type in the description of the changes then save the file.)
After performing the commit, if we run git status one more time it should
tell us there is nothing to commit and the working tree is clean,
but will also tell use our branch is ahead of origin/master by 1 commit,
meaning we have made local changes that we haven't yet copied back to
our repository on the git server.
Now, to save our changes back to the central repository (so the instructor can
access them) use the command
git push
If we try git status after the push, we should see our branch is up-to-date with 'origin/master'.
The questions for part 2 are in the README file in your repository,
use the following command to view the README contents:
less README
(Type q to quit/get out of less.)
Once you have completed the steps above (and saved the file), be sure to add, commit, and push your updates like we did in Part 1:
As with part 2, the actual questions are in the README, and you should use your preferred editor to put your answers in file answers.txt.
Once you have done that (and saved the file), be sure to add, commit, and push your updates like we did earlier:
REMEMBER: if you miss the add, the commit, or the push then your changes never make it back to the central repository, so they'll never get marked!