Assignments in this course will be done using the GIT version control system used to maintain, among other things, the Linux Kernel.
Note that this guide is written assuming the student is logged into one of VIU's CSCI student workstations or servers (otter.csci.viu.ca, or one of the cub/pup workstations).
The following steps should be used when starting an assignment:
There will be an initial instructor repository for each lab whose name will be of the form:
csci260/Lab[1..n]where the digit after the name Lab indicates the lab number (e.g., 1, 2, etc.).
Server-side student repositories will have names of the form:
csci260/USERNAME/Lab[1..n]where USERNAME is the student's username.
Client-side student repositories will have names of the form:
Lab[1..n]It is strongly encouraged that students place client-side repositories in a subdirectory indicating the name of the course, such as csci260 or 260.
Note that the following commands are for Lab1 (Lab 1). Subsequent labs will use Lab2, Lab3, etc. Assignments will use Assignment1, Assignment2, etc.
Run the following command to create remote fork of the instructor's initial repository on the server:
$ ssh csci fork csci260/Lab1 csci260/$USER/Lab1Your instructor will clone the resulting repository at the start of the grading process.
The next step is to make a local (client-side) working copy of your repository.
If you have not already done so, create a directory for this course and change directory into it - something like:
$ mkdir -p ~/csci260 $ cd ~/csci260
Then clone your assignment repository:
$ git clone csci:csci260/$USER/Lab1If this step is successful you should now have a subdirectory called Lab1. Change directory to it now:
$ cd Lab1
In the event the instructor needs to make a change to the initial files, it is useful to set the original repository as an upstream. This may be done with the following command:
$ git remote add instructor csci:csci260/Lab1If the instructor says an update is available, you can fetch the changes, but not apply them, with the following command:
$ git fetch instructor
You should now be able to compare your currently committed "HEAD" state with the instructor's master branch as follows:
$ git diff HEAD instructor/master
If you wish to merge the changes, it is recommended that you commit any outstanding changes you wish to keep (see below), then run the diff command again as a double check, then run:
$ git merge instructor/master
If there are no conflicts, an editor will be presented to allow you to enter a commit message which works essentially like a normal commit would.
If there are conflicts, you'll need to resolve them before continuing. Resolving a merge conflict from the command line on GitHub gives a good overview of the process when performed on the command line.
Note that the master branch is being assumed through this document. It is possible that your instructor is using other branches. To be continued...
Whenever you hit a point where you would like to save the current state of your assignment, the following pattern can be used to do a local "commit":
$ git add . $ git commit -m "Added feature foobar."
It is recommended you commit your changes whenever you hit a "plateau" (that is, have a new feature working), or when you are going to try something that may not work out.
You are free to use git in a more sophisticated manner, but ensure that all your changes eventually make their way to the server (see below).
When you would like to submit your solution, commit all the local changes and then run the following command:
$ git push
Which should push your local "master" branch to the server.
If you have created additional branches that have not been merged, but that you would like to submit, you will likely need to configure git to push them as well. Please feel free to see the instructor for assistance.