This tutorial will address the source code management (SCM) tool named Git. By following these steps you should learn about the basic usage of Git, which is required for the whole practical course. Furthermore, Git is a great SCM tool, and it's good to know how to use it. During this tutorial, we will follow Alan Turing's thoughts towards developing the Turing Machine.

More in-depth documentation can be found on the official home page, which mentions books, videos, and links to other tutorials and references.

Creating Commits

  1. Read the Git for Computer Scientists introduction (skip this if you are already familiar with Git). 
  2. For Linux, Git is available in its own package. Windows users can install msysGit. For MacOS, Git is available as part of Xcode; if you cannot install that, use Git for OSX.
  3. Configure your name and email address (will be included in all commits you create):

    Unknown macro: noformat. Click on this message for details.

  4. Create a local repository for the "Turing Project":

    Unknown macro: noformat. Click on this message for details.

  5. Add and commit some content: copy notes.txt to your turing directory.

    Unknown macro: noformat. Click on this message for details.

  6. Edit notes.txt:
    1. Replace "fixed" with "infinite" in line 1.
    2. Replace "... (TODO)" with "a finite state machine" in line 4.
  7. View the status of your current working copy:

    Unknown macro: noformat. Click on this message for details.

  8. Mark the modified file to include it in the next commit, then view the status again and compare with the previous output:

    Unknown macro: noformat. Click on this message for details.

  9. Commit the modified content to your local repository and view the status:

    Unknown macro: noformat. Click on this message for details.

After the preceding steps you have two commits in your local repository, each with one file in the index. You have different commands for viewing these commits:

Unknown macro: noformat. Click on this message for details.

Note that each commit is identified by a looong hash value, but it is possible to use only a prefix when referencing them (if the prefix is not ambiguous): the example above uses 52e2d49 to identify the second commit. Also try the command gitk to get an overview of your commits (a better alternative available for MacOS is GitX). The commit hashes in your repository will be different from those seen in this tutorial, because the name of the author and the exact time of committing is also considered in the hash calculation.

Tags:
Created by msp on 2012/10/15 11:15