Twig uses workspaces to let you work on multiple tasks without conflicts. Each workspace is isolated, so changes in one don't affect others until you're ready to merge.
A workspace in twig is a separate working copy of your repository. Under the hood, it uses Git worktrees - a Git feature that allows multiple working directories from a single repository.
This means:
Working on a feature when an urgent bug comes in? Create a new workspace for the bug fix without losing your feature work.
Run multiple experiments simultaneously. Compare different approaches in separate workspaces.
Keep unrelated changes apart. No more "I'll just add this quick fix to the same branch."
When you start a new task in twig, it creates a workspace automatically. Each workspace gets:
Switch between workspaces to move between tasks. Your changes in each workspace remain intact.
When you're done with a task, the workspace changes can be committed and merged like any Git branch.
Git worktrees are a native Git feature (since Git 2.5). A worktree is an additional working directory attached to your repository.
Traditional Git workflow:
repo/
.git/
src/
...
With worktrees:
repo/
.git/
src/
...
repo-feature-a/ (worktree)
src/
...
repo-bugfix/ (worktree)
src/
...
All worktrees share the same .git directory, so:
Keep workspaces focused. If a task grows to include multiple unrelated changes, consider splitting it.
Name workspaces after what you're working on: "add-user-search", "fix-login-timeout", etc.
Once changes are merged, delete the workspace to keep things tidy.
If you find yourself wanting to make changes across workspaces, it might be time to merge one and continue in a single workspace.