Ancient CS 61 Content Warning!!!!!1!!!
This is not the current version of the class.
This site was automatically translated from a wiki. The translation may have introduced mistakes (and the content might have been wrong to begin with).

Version control

A version control system is a program that tracks metadata about edits or changes made to files in a given folder, and makes it easy to track changes, revert changes, and synchronize changes between users. Version control systems are widely used in industry. The allow lets multiple people in different locations work together, editing the same files, and not have to worry about overwriting each other's changes. Version control also makes it easy to undo a messy change!

We strongly encourage you to use a version control system for your programming assignments, whether you are working by yourself, or with a partner. It is good for you to learn how to use version control, and it will help you with the development of your software.

The remainder of this document gives you information about using Git, one of the most popular version control systems. The SEAS Academic Computing Group provides an online git repository and project management website. The following section tells you how to register and use this website, and we then give you some tips on using git.

Git was originally developed by Linus Torvalds for development of the Linux kernel. Git is a distributed version control system. Centralized version control software typically supports a single, remote repository from which all users "checkout" files. All changes must be sent to the repository to be tracked and shared. A distributed version control system supports many local repositories which each track changes and can synchronize with each other in a peer-to-peer fashion.

code.seas.harvard.edu

The SEAS Academic Computing group provides an online git repository and project management website at https://code.seas.harvard.edu. We recommend you use it for your programming projects in CS61.

The remainder of this page gives brief instructions for getting started on the repository, specialized, where appropriate, for CS 61. For more detailed instructions, please refer to the SEAS Code Repository documentation.

Signing up

  1. Go to https://code.seas.harvard.edu/login
  2. Enter in your FAS credentials (i.e., the same credentials you use to ssh to cs61-login.seas.harvard.edu).
  3. You may be directed to an OpenID Verification page that asks you to confirm your identity. Click the "Allow Always" button on the right of the screen. You may then be asked to enter some details for your profile, but will eventually see your Dashboard.
  4. The next step is to add your SSH keys
    • SSH keys provide you with a way to easily access your git repositories from your CS61 VM.
    • If you haven't already, you need to create an SSH key on your CS61 VM.
    • You can check out this handy HCS tutorial, or follow these steps:
      • ssh to your VM.
      • Run "ssh-keygen -t dsa" and follow the instructions.
      • You have now created your ssh keys. They live in the directory ~/.ssh
      • Now run "cat .ssh/id_dsa.pub" to display your public key.
      • Copy your public key (that is, select the text on the screen, and copy it to the clipboard), and in the SEAS Code Repository, click "Add SSH Key", and paste your key into the field, and click "Save".

Creating a project for your team

Only one team member needs to do these steps:

1. Create a project: name it CS61 (username 1) (username 2)

2. Create a repository for the project with the same name

3. Add your partner to the project

4. Make sure your repository is private:

Initializing your local repository

To get your project under version control, each member of your team needs to create a local copy of the repository, following these instructions:

1. Log in to your CS61 VM

2. Configure your git "identity":

3. Rename your old lab directory so it doesn't get overwritten

4. Make a local copy of the repository:

(Note: if you get an error about "sha/ref", try

git clone git@code.seas.harvard.edu:PROJECT_NAME/REPOSITORY-NAME.git NAME_OF_DIRECTORY

or edit the address in the config file in the .git folder in your repository root (i.e. edit the file ".git/config) to point to git@code.seas.harvard.edu:PROJECT_NAME/REPOSITORY-NAME.git)

5. Now one member of your team will populate the repository with the lab files:

cp -R ../OLD_LAB_DIRECTORY/* . (from within the new repository directory)

6. Finally, the other member of your team will pull down the new files:

If all went well, they should now have all of the files uploaded in step 5!

Using git

Academic Computing has an introductory guide to git on their website https://ac.seas.harvard.edu/display/USERDOCS/Introduction+To+GIT, but here are a few commands you'll need to be familiar with.