Appearance
Adopting Existing Repositories
Already have a traditional Git repository? You can convert it to the worktree layout without losing any work.
What daft adopt Does
daft adopt restructures a traditional repository into daft's worktree layout:
Before:
my-project/
├── .git/ # Regular git directory
├── src/
├── package.json
└── README.mdAfter:
my-project/
├── .git/ # Bare repository
└── main/ # Worktree for current branch
├── src/
├── package.json
└── README.mddaft adopt converts to the contained layout. To use a different
layout, run daft layout transform <layout> afterward, or clone fresh with daft clone --layout <layout>. See Layouts. :::
Running It
bash
cd my-existing-project
daft adoptOr specify a path:
bash
daft adopt /path/to/my-projectPreview First
Use --dry-run to see what would happen without making changes:
bash
daft adopt --dry-runUncommitted Changes Are Preserved
Any staged, unstaged, or untracked changes in your working directory are carried into the new worktree. You won't lose any work.
Reverting with daft eject
If you decide the worktree layout isn't for you:
bash
daft ejectThis converts back to a traditional repository layout:
Before:
my-project/
├── .git/ # Bare repository
├── main/
│ ├── src/
│ └── README.md
└── feature/auth/
├── src/
└── README.mdAfter:
my-project/
├── .git/ # Regular git directory
├── src/
└── README.mdBy default, daft eject keeps the remote's default branch. Use --branch to specify a different one:
bash
daft eject --branch feature/authOther worktrees are removed. If any have uncommitted changes, the command fails unless you pass --force.
Git-native equivalents daft adopt is also available as
git worktree-flow-adopt, and daft eject as git worktree-flow-eject. :::
When to Adopt vs Clone Fresh
Use daft adopt when:
- You have an existing local repository with work in progress
- You want to try the worktree workflow without re-cloning
- You have local branches or stashes you want to preserve
Use daft clone when:
- Starting fresh from a remote repository
- Setting up a new development environment
- The repository has no local-only work to preserve
- You want to choose a specific layout with
--layout