|It is crucial that you read and understand these
instructions all the way through before beginning, then:
think about what each step is trying to achieve,
before you hit enter, re-read what you actually typed in,
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 has a high probability of blowing up
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:
|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)
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.
|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.|
*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 branches.|
If step 2 or step 3 didn't work, and all you see in the new repository
is a single default README file
(e.g. if you forgot to fork, or made a mistake in the fork command but did the clone anyway),
or you simply want to start all over, then you can try the following fix:
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
Type in ls to verify that the expected files were copied across.
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
Note that if there are conflicting changes between the instructor files and your own then it will let you know what files need to be edited to resolve the changes, and once it completes it will open an editor window for you to enter a commit message.
An alternative is to use
git pull instructor master
which will automatically carry out the merge (fetch is nice/safer in that you can use git diff to see what has changed and then choose whether or not to begin the merge process).
Again, you may need to resolve conflicting changes and it will open an editor window at the end for you to enter a commit message.
Commit whenever you have a new feature working or when you are about to try a change that might not work out.
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 you want to push another branch, use the command
If you want to push all branches, use the command
|Note the commands above assume the master branch is the
one of interest.
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
If you want to clone a specific branch you can use the following
git clone csci:csci265/$USER/item --branch thebranchname