Lecture 6 - Version Control (Git)
View lecture View lecture notes
Exercises
-
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.
-
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: usegit 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: usegit blame
andgit show
).git blame _config.yml git show a88b4eac
git blame
shows what revision and author last modified each line of a file. Here thecollections:
line of the_config.yml
file contains the sha1hasha88b4eac
. 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 followsRedo lectures as a collection
.