Chapter 19 · CLI
Parallelism: worktrees, background tasks and agent view
Parallel work advances several tasks at once: worktrees give separate working copies of the repo, background tasks run in the background, and agent view centralizes managing multiple agents.
Video
Steps
- Create a worktree per parallel task so changes do not trample each other in the same working directory.
- Run a separate session on each worktree; each session sees its own copy and can commit separately.
- Push long tasks (tests, builds) to the background while the session keeps working.
- Agent view shows active agents and enables tracking; check progress before merging back to the main branch.
Mechanism animation (illustration)
Common pitfall: Parallelism without coordination produces merge conflicts; plan upfront which files each task touches.
Hands-on exercise: Create a worktree, make a small change in it alongside work on the main branch, and merge back. Record any conflicts.
Filmed demo · Video is added in the media phase
Recap
Comprehension check
What problem do worktrees solve?
Recap
- A worktree per parallel task
- Background tasks for long jobs
- Upfront planning prevents conflicts