Getting started
Repositories and commits, the working tree, index and HEAD, and how to see what changed with diff, log and blame.
About 4 hours of study
Learning objectives
- Create commits with clear messages
- Read git status and use the index
- Read diffs and investigate history
Lessons
- 1
Version control and your first repository Intermediate
Why every project keeps its history in version control, what a Git repository is, and the first commands: configure Git, create a repository, check its status and look at the history.
- 2
Staging and committing Intermediate
Git has three places for your files: the working tree, the staging area and the last commit. Choose exactly what goes into each commit with git add, record it with git commit, and read the codes that git status prints.
- 3
Viewing changes: diff, log and blame Intermediate
See exactly what changed: compare versions line by line with git diff, read the history with git log and git show, and find who last changed each line with git blame. Learn the longest-common-subsequence idea behind every diff.
Module practice
- Git: Check a commit messageEasy
- Git: What changed between two commits?Medium
- Git: When does switching commits refuse?Hard
- Git: Read a configuration fileEasy
- Git: Compute git status --shortMedium
- Git: A tiny Git in PythonHard
- Git: Summarize a diffEasy
- Git: A line diff from the longest common subsequenceMedium
- Git: Blame each lineHard