

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Worktrees
incomplete
2: Linked Worktrees
incomplete
3: No Duplicate Branches
incomplete
4: Tracking
incomplete
5: Upstream
incomplete
6: Delete Worktrees
incomplete
This lesson's interactive features are locked, please to keep using them
We've talked about:
Stash (temporary storage for changes)
Branches (parallel lines of development)
Clone (copying an entire repo)
Worktrees accomplish a similar goal (allow you to work on different changes without losing work), but are particularly useful when:
You want to switch back and forth between the two change sets without having to run a bunch of git commands (not branches or stash)
You want to keep a light footprint on your machine that's still connected to the main repo (not clone)
Contains the .git directory with the entire state of the repo
Heavy (lots of data in there!). To get a new main working tree requires a git clone or git init
Contains a .git file with a path to the main working tree
Light (essentially no data in there!), about as light as a branch
Can be complicated to work with when it comes to env files and secrets
To create a new worktree at a given path:
git worktree add <path> [<branch>]Adding <branch> is optional. It will use the last part of the path as the branch name.
Run and submit the CLI tests from the root of the main working tree (megacorp).