CS 231: Computer Security

Minimal intro to git as used in this course

git is a version control system that is free and open source, and extremely widely used among software developers world-wide. In brief, version control systems provide a kind of "track changes" service that supports systematic backup, recovery of previous work, collaboration between people on shared documents, etc.

In CS231, we will use git to enable you and me to collaborate in the sense that you can submit various versions of your code and other documents, and I can see your work and provide feedback. On those occasions when you collaborate with a classmate on an assignment, git will also enable you to share code and maintain a central shared copy of your code.

This document describes simple steps for the git operations you are most likely to use in this class. It is not intended to be an introduction to the concepts behind version control, git, or GitHub. For a more thorough introduction, try out one of the many git tutorials on the internet. This one, for example, looks pretty simple and helpful to me.

Resources

If you want to dig deeper than this document, here are a few resource I provide my CS257 classes to help them get up and running with Unix and git.

0. Overview of workflow

  1. Create a GitHub repository
  2. Get a clone of the repository onto your computer.
  3. Add new files or modify existing files. That is, do some work.
  4. Prepare to commit your changes to the repository by including the files whose changes you want to commit in the staging area
  5. Perform the commit
  6. Push the changes to github.com
  7. If you have more work to do, go to step 3.

1. Create a GitHub repository

2. Get a clone of your repository on your computer

A git repository is essentially a folder full of subfolders and files, plus information about the history of changes that have occurred over time as files have been added, edited, moved, renamed, deleted, etc. To use a git repository, you need to clone (that is, copy) it onto your computer. You can do this using either a GUI git client or the git command-line client.

Once you have created your repository, you can go to github.com and see the new repository in the "your repositories" section of the page (on the left). Click on the link to your new repository and poke around a little bit.

Now, to obtain a clone of your repo onto your own computer, do one of the following.