Link Search Menu Expand Document

Lecture 6 - Version Control (Git)


View lecture View lecture notes

Exercises


  1. If you don’t have any past experience with Git, either try reading the first couple chapters of Pro Git or go through a tutorial like Learn Git Branching. As you’re working through it, relate Git commands to the data model.

    Self explanatory.

    Unrelated to the question but this Git cheatsheet from Atlassian might be quite handy for the rest of the questions and in general for life.

  2. Clone the repository for the class website.

    a. Explore the version history by visualizing it as a graph.

      git log --graph
    

    git log will give a linear history of all the commits. Adding the --graph flag prints out a graph to go along with the commits.

    b. Who was the last person to modify README.md? (Hint: use git log with an argument).

      git log README.md
    

    git log <filepath> lists only the commits in which the aforementioned file has been modified.

    c. What was the commit message associated with the last modification to the collections: line of _config.yml? (Hint: use git blame and git show).

      git blame _config.yml
    
      git show a88b4eac
    

    git blame shows what revision and author last modified each line of a file. Here the collections: line of the _config.yml file contains the sha1hash a88b4eac. Hence, on running the subsequent command, that is, git show a88b4eac will show the log message associated with that commit. The commit message reads as follows Redo lectures as a collection.