CSCI git project and lab submission
There is a Git Submit FAQ
in the department tutorials.
For general git commands and info, see these git notes.
|It is crucial that you read and understand these
think about what you are doing at each step...
pay attention to what you are typing in....
every word of every instruction you type...
read and try to understand any warnings or error messages that are displayed
before proceeding further...
Cutting and pasting chunks of instruction into your
command window will result in disasters,
and you will get no sympathy from the instructor.
.... slow down
... read to the end before you begin
... pay attention
... read and think about what's happening
This project code, examples, assignments, quizzes, labs, and other
related material may be distributed and
collected through the use of the git version control tool.
The basic idea is as follows, detailed instructions are provided afterwards:
- A central git repository is maintained by the department,
with a section within it for each course (e.g. csci265).
- For various assignments, projects, labs, quizzes etc,
there will be a special repository containing the relevant material
the instructor is distributing to the students.
- Each student will also have a central repository
where they maintain their current official submission for the project/quiz.
- When the material is released by the instructor, the students will
initialize their own repository as a copy of the instructor's.
- The student will then create a working copy within their regular
csci account (e.g. on otter), and use that copy to make all their desired changes as they
build their solution.
The student will use appropriate git commands (commit, branch, merge, etc)
to maintain their local working copy, and
as often as desired (prior to the deadline of course) the student
can push their most recent version of their work back to the central
|I strongly recommend students become comfortable
with the basic use of each of the following git commands:
add, commit, branch, checkout, merge, tag, revert, rm, show,
push, and fetch as well as basic familiarity with gitk
(quick reference for git stuff here)
- After the deadline passes, the instructor will retrieve the
latest version of the students' work from the central repository and
use that as the basis for marking the phase/quiz.
Note that the examples below are based on csci265 and an assignment named phase1,
you will need to make appropriate substitutions in the commands if you are using these
instructions for a different course or for another lab/assignment/project phase.
Step 1 is done once only at the start of the first lab, while steps 2-4 will be done once
for each assignment/lab/project phase.
- Once only, at the start of the first lab, on otter (or one of the pups or cubs)
create a directory for your csci265 material:
|For each of steps 2-4 check that you are entering the command
as shown below, your only substitutions should be for the course number (instead of 265) and the
assignment name (instead of phase1). Be very careful, and
be sure you complete each step successfully before moving on to the next.
Only do step 5 if/when the instructor explicitly asks you to.|
- You can see your current central repository information using the command
ssh csci info
For each repository you have access to, this shows the name of the repository,
and one or more of RWC (for Read access - you can fork/clone it, Write access - you
can push to it, Creator - you created it)
- At the initial release of each phase/quiz, create your own fork
of it on the central repository using the command:
ssh csci fork csci265/phase1 csci265/$USER/phase1
(note the command is shown for a project/lab named phase1, for one called phase2 you would substitute
phase2 for phase1, for quiz1 you would substitute quiz1, etc)
*If you find you are getting warnings about x11 when you run the ssh command,
you can include the option -x to prevent them.
|Note that this creates a repository of your own on the
central server containing a copy of the instructor's repository, including all the
- Once you have your central version set up, it is time to create
a working copy in your own account. This is done as follows:
git clone csci:csci265/$USER/phase1
|Note this copies the master branch from your
central repository to your own linux account. If you want to see if there
are other branches available you can use the command
git branch -a
If you want to then copy any of those branches to your local version
you can use the command
git pull origin NameOfTheBranch
- Now you can add the instructor's repository as an upstream
so you can fetch updates from the instructor if necessary:
git remote add instructor csci:csci265/phase1
Type in ls to verify that the expected files were copied across.
If step 2 or step 3 didn't work, and all you see is a single README file
(e.g. if you forgot to fork, or made a mistake in the fork command but did the clone anyway),
you can try the following fix:
- Remove the local directory, e.g.
rm -r phase1
- Move the mistakenly forked central repository to the trash repository, e.g.
ssh csci D trash csci265/$USER/phase1
- Go back to your fork/clone and try again
If you would like to see what you have put in the trash,
ssh csci D list-trash
If you would like to get something out of the trash,
use the name/date of the file to restore as seen in the listing above, e.g.
ssh csci D restore csci265/$USER/phase1/2016-02-10_14:00:00
- How to fetch a new version from the instructor if the instructor
tells you an update has been posted and needs to be fetched:
ONLY DO STEPS (5a)-(5c) IF I EXPLICITLY TELL YOU A NEW UPDATE NEEDS TO BE RETRIEVED - hopefully that will rarely be the case
If an update is issued you can retrieve it using
(5a) git fetch instructor
You can then see what has changed using
(5b) git diff HEAD instructor master
You can then make any changes needed and merge the instructor's master into yours with
(5c) git merge instructor master
- You can edit and save any changes you need to in your working copy
as you work on the phase/quiz, committing them using
git add filename (to include your added/changed file for the next commit)
git add . (to add all your added/changed files for the next commit)
git rm filename if you want to get rid of a file (-r for directory)
git mv oldname newname if you want to move or rename a file or directory
git add -u (so any files you've removed locally also get removed from the repository)
git commit -m "---some message describing the change---"
(to actually create the commit point and associate a message with it)
Commit whenever you have a new feature working or when you are about
to try a change that might not work out.
- Submit the master branch of your updated solution to the central repository using
If you want to check for added or committed differences between your current
local repository and your central repo, use
git diff origin/master...HEAD
(It should come up with nothing if you've pushed all your changes,
but it won't detect local changes without the appropriate git add.))
You can check the status of your local repository (to see if you've forgotten
any adds or commits) using the command
- if everything is up to date we should see "up-to-date with origin/master"
- if we've committed but not yet pushed then we should see "ahead of origin/master by 1 commit" (or more than 1 possibly)
- if we've added but not yet committed then we should see there are "changes to be committed"
- if we've changed files but not yet added them we should see there are "untracked" files
If you want to push another branch, use the command
git push origin NameOfTheBranch