UNB/ CS/ David Bremner/ teaching/ cs2613/ labs/ CS2613 Lab 2

Background

Part 0: Git Tutorial Part II: Working with multiple repos

Time
15 minutes
Activity
Work in Pairs

For this part of the lab, form pairs. If there's an odd number of people, form a triple.

Cloning

Each person in the pair should carry out the following actions at neighbouring computers.

  1. Open a terminal on the FCS Linux session (i.e. not in the fcs-cs2613-dev VM). Make a directory lab1-scratch somewhere outside the cs2613 git repository you created earlier.

  2. Now move to the lab1-scratch directory, and make a clone of the central repo.

     $ git clone https://<username>@vcs.cs.unb.ca/git/cs2613-<username> cs2613-clone
    

    This creates a new directory "cs2613-clone" containing a clone of your repository. Notice that in general this is a good way of checking that your work is properly submitted. The TA and Prof will do exactly this cloning step in order to mark your work. The clone is on an equal footing with the original project, possessing its own copy of the original project’s history.

Viewing project history

  1. At any point you can view the history of your changes using

     $ git log
    

    Use this command to verify that all the changes you expected to be pushed to the server really were.

    If you also want to see complete diffs at each step, use

     $ git log -p
    

    Often the overview of the changes is useful to get a feel for each step

     $ git log --stat --summary
    
  2. Temporarily trade computers with your partner. Use git log to examine the history of their repo. Consider their commit messages, and the construction of their commits (i.e. what changes are commited together). Discuss how each of your might improve your history, if possibly by learning from the other.

Sharing changes with a central repo

For the remainder of Part 0, work together on one computer.

  1. Switch to (or open) a terminal in the fcs-cs2613-dev VM.

  2. Navigate to the ~/fcshome/lab1-scratch/cs2613-clone/frog directory.

  3. create a new blog entry, and commit it.

  4. Push your changes back to the central repository.

     $ git push origin master
    
  5. Change directory to your original directory ~/fcshome/cs2613. Bring in the changes you made

     $ git pull origin
    

This merges the changes from the central copy of "master" branch into the current. branch. If you made other changes in the meantime, then you may need to manually fix any conflicts.

The "pull" command thus performs two operations: it fetches changes from a remote branch, then merges them into the current branch.

Git next steps

Congratulations, you now know enough git to finish this course.

There is lots more to learn, particularly about branching and collaboration. If you want to get a big(ger) picture view, a good place to start is Git Concepts Simplified.

Part 1: Hello World

Time
15 Minutes
Activity
Small groups, discussion, puzzle solving

1.1 Command Line

1.2 DrRacket: A Racket Specific IDE

1.3 If you have extra time

Byte compilation

more IDE stuff

1.4 Discussion

Part 2: Squaring the Circle.

Time
20 minutes
Activity
Individual work, following a detailed tutorial

Part 3: Functions, Scope, and Lists

Time
20 minutes
Activity
Individual work, following a detailed tutorial

Part 4: More about lists

Time
15 min
Activity
Small groups, programming by example.