Skip to content

git worktree-flow-adopt

Convert a traditional repository to worktree-based layout

TIP

This command is also available as daft adopt. See daft adopt.

Description

WHAT THIS COMMAND DOES

Converts your existing Git repository from the traditional layout to daft's worktree-based layout. After conversion:

Before: After: my-project/ my-project/ ├── .git/ ├── .git/ (bare repository) ├── src/ └── main/ (worktree) └── README.md ├── src/ └── README.md

Your uncommitted changes (staged and unstaged) are preserved in the new worktree. The command is safe to run - if anything fails, your repository is restored to its original state.

ABOUT THE WORKTREE WORKFLOW

The worktree workflow eliminates Git branch switching friction by giving each branch its own directory. Instead of switching branches within a single directory, you navigate between directories - each containing a different branch.

BENEFITS

  • No more stashing: Each branch has its own working directory
  • Parallel development: Work on multiple branches simultaneously
  • Persistent context: Each worktree keeps its own IDE state, terminal history, and environment (.envrc, node_modules, etc.)
  • Instant switching: Just cd to another directory
  • Safe experimentation: Changes in one worktree never affect another

HOW TO WORK WITH IT

After adopting, use these commands:

daft go <branch> Check out an existing branch into a new worktree

daft start <new-branch> Create a new branch and worktree from current branch

daft start <new-branch> main Create a new branch from a specific base branch

daft prune Clean up worktrees for merged/deleted branches

Your directory structure grows as you work:

my-project/ ├── .git/ ├── main/ # Default branch ├── feature/auth/ # Feature branch └── bugfix/login/ # Bugfix branch

REVERTING

To convert back to a traditional layout, use git-worktree-flow-eject(1).

Usage

git worktree-flow-adopt [OPTIONS] [REPOSITORY_PATH]

Arguments

ArgumentDescriptionRequired
<REPOSITORY_PATH>Path to the repository to convert (defaults to current directory)No

Options

OptionDescriptionDefault
-q, --quietOperate quietly; suppress progress reporting
-v, --verboseBe verbose; show detailed progress
--trust-hooksTrust the repository and allow hooks to run without prompting
--no-hooksDo not run any hooks from the repository
--dry-runShow what would be done without making any changes

Global Options

OptionDescription
-h, --helpPrint help information
-V, --versionPrint version information

See Also

Released under the MIT License.