Intern Track Roadmap

Git workflow: add & commit

This course follows a change from the working tree to the commit history in Git. It explains why a commit records the staging area and how to stage whole files, tracked files only, or single hunks with git add -p. It covers commit messages with an imperative subject line and a body that explains why. It then shows how to undo mistakes with git restore, git reset, git commit --amend and git revert. It ends by building a small Rails feature as three clean commits.

What you'll learn

  • ✓Why a commit captures the staging area and how to check it with git diff --staged
  • ✓Staging with git add ., -A, -u and partial staging with git add -p
  • ✓Writing commit messages with an imperative subject, a body and atomic commits
  • ✓Undoing changes safely with git restore and the three levels of git reset
  • ✓Fixing the last commit with --amend and undoing shared commits with git revert
Free preview · Lesson 1 3 min read

From working tree to history: the commit lifecycle

The last course introduced three states a file moves through, and let you use git add and git commit just enough to prove a repository worked. This course is the deep dive. It covers every option, every safety net, and the habits that make a commit history readable for a teammate.

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...