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

Lessons

  1. 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. 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. 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

Module quiz

1. What is a commit?
2. What does git add do?
3. What does 'MM app.py' mean in git status --short?
4. Which command shows what the next commit will contain?
5. What does a line diff keep unchanged?
6. What does git blame show for each line?

Inside Git ›