We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Worktrees

We've been saying "worktree" all throughout this course but I've been misusing it... I am sorry :(

I've been saying "worktree" when I meant "main worktree", which is more precise because you can have more than one working tree.

What Is a Worktree?

A worktree (or "working tree" or "working directory") is just the directory on your filesystem where the code you're tracking with Git lives. Usually, it's just the root of your Git repo (where the .git directory is). It contains:

  • Tracked files (files that Git knows about)
  • Untracked files (files that Git doesn't know about)
  • Modified files (files that Git knows about that have been changed since the last commit)

The Worktree Command

Git has the git worktree command that allows us to work with worktrees. The first subcommand we'll worry about is simple:

git worktree list

It lists all the worktrees you created.

Assignment

List all your worktrees.

Copy/paste the output into the textbox and submit.