4.6. Course Git Repository

All course sample code and designs are also available via a private git repository stored on Andrew AFS. This is a starting point for using git for version control of the project code.

4.6.1. Basics

Git is a software tool for version control which provides the means to track changes in a set of files over time and share them with other people.

I am using the Andrew general purpose unix server to serve a set of private repositories on the course AFS space available to current class members. Your normal Andrew user ID and password will be required for access.

There are many online tutorials related to git. Some good starting points follow:

Note that there are many different git clients available, ranging from the standard command line tools to visual GUI-based applications. Each has their merits; the visual interfaces are much more beginner-friendly, but some sophisticated operations are only possible from the command line, so many users will install both to use as needed.

The IDeATe cluster MacBook Pros should have three different git clients:

GitX.app GitX visual client for OS X
/opt/local/bin/git command line client provided via MacPorts
/usr/bin/git outdated command line client provided by Apple

Note the the Github Desktop GUI client is not recommended for use with this course as it is not hosted on github; GitX.app is suggested instead for OS X, and a suggested alternative under Windows is SourceTree with the SSH Client set to PuTTY/Plink.

4.6.2. Using a Course Repository

The first step is to clone the repository, which will create a local copy in a new folder on your local machine. If you are using a command line client, the command will look like the following, only substitute your own Andrew ID:

git clone garthz@unix.andrew.cmu.edu:/afs/andrew/course/16/375/f2016/rcp-Max-examples

This will create a new folder named rcp-Max-examples in the current folder. The repository can be updated to the current version using pull, which will fetch the upstream changes and merge them into the local copy:

cd rcp-Max-examples
git pull

The cd command makes the repository folder current, and the git pull command performs the fetch and merge.

Note that if you have made incompatible changes, this may result in conflicts. Please refer to the git manual to learn how to create your own branches and resolve conflicts. The most common cause for this is modifying the course source files in-place. If you are not planning to keep your own revisions in version control, the recommended practice is to duplicate provided files before modifying them to minimize your trouble later.

4.6.3. Initial Repositories

  • /afs/andrew/course/16/375/f2016/rcp-kit-sw-models: SolidWorks files
  • /afs/andrew/course/16/375/f2016/rcp-Max-examples: Max patches
  • /afs/andrew/course/16/375/f2016/rcp-Arduino-Examples: microcontroller code

4.6.4. Creating Project Repositories

Experienced git users may know they can clone a personal copy of a repository, and that will be the recommended way of creating project-specific code from the given examples. We’ll talk about workflow in class.