Search⌘ K
AI Features

Git with Test-Driven Development

Explore how to use Git as a source control system within Test-Driven Development for React. Understand how to initialize a Git repository, manage files with .gitignore, stage and commit changes with gitmoji, and maintain an all-green test state for reliable project history.

Checking in changes

Whenever you add a new test and get it to pass, that’s a good time to get your project into source control. That way, no matter what you do to the project, you can always restore it to the all-green state later.

We’ll use Git as our source control system in this course. If you’re not familiar with Git, you might want to read through the “Git Basics” section of the excellent Pro Git by Scott Chacon and Ben Straub.

The first step is initializing this project as a Git repository:

$ git init
Initialized empty Git repository in
/Users/tburnham/code/test-driven-fizzbuzz/.git/

Don’t commit just yet. If you run git status, you’ll notice that ...