Project Setup and Source Code Gitting

CSE 401

Winter 2014

Nat Mote and Svet Kolev

Robert R. Henry

We will be using Git for version control for the MiniJava project. We have provided the skeleton code in a Git repository, and we strongly encourage you to use Git to collaborate with your partners.

We have provided each of you with a folder on the instructional machines that you may use to collaborate with your partners. Instructions on how to set up a shared Git repository follow. You are not required to use these folders to collaborate, but other workflows will not be supported by the course staff. If you choose to use to host your code elsewhere, make sure that it is private. We do not want you to inadvertently share your solution with other students, whether they are from this quarter or a future quarter. Note that Github, by default, does not allow you private repositories. Bitbucket is a suitable option, as long as you ensure that your repository is not public.

Some good Git resources:

To get your project set up, you must first clone the repository that we provide you. The following instructions assume that you are working on attu or a lab machine, but would only need minimal changes to work elsewhere. In these instructions, I use ‘[‘ and ‘]’ to delimit text that you will need to replace with something else.

In a directory of your choosing, run:

git clone --origin template /projects/instr/14wi/cse401/template minijava

This creates a copy of the skeleton code in a folder named ‘minijava’

You may make changes, change to the minijava directory, and then run:

git commit -am “[useful commit message]”

When you add new files, you will have to run:

git add [file names]

before committing.

This will make a commit in your local copy of the git repository.

To set up a way to collaborate with your partners, you must first learn your UNIX group (of the form cse401a - cse401z, cse401aa-cse401az …). To learn your UNIX group, run:

kinit (and enter your CSE password -- this gives you Kerberos credentials)

grpadmin listugrps [your CSE username]

This will list some groups, including the cse401 group that you are in. You and your partner should get the same cse401 group. If you do not, contact the course staff.

We have provided space in /projects/instr/14wi/cse401/ for each group to have a repository. One of you should run the following command:

git init --bare --shared=group /projects/instr/14wi/cse401/[group name]/minijava

In the repository where you cloned the template code, both of you should run:

git remote add origin /projects/instr/14wi/cse401/[group name]/minijava

To share your changes with your partner, run:

git push origin master

To get changes that your partner has made, run:

git fetch origin

git merge origin/master

If you have been working on the same piece of code, you may have a merge conflict, which you will have to resolve yourself. See here:

If we make changes to the provided code, we will push to the template repository. To incorporate the new code, make sure you have committed all of your changes (run ‘git status’ to check), and then run:

git fetch template

git merge template/master