Skip to content

git worktree-flow-eject

Convert a worktree-based repository back to traditional layout

TIP

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

Description

WHAT THIS COMMAND DOES

Converts your worktree-based repository back to a traditional Git layout. This removes all worktrees except one, and moves that worktree's files back to the repository root.

Before: After: my-project/ my-project/ ├── .git/ ├── .git/ ├── main/ ├── src/ │ ├── src/ └── README.md │ └── README.md └── feature/auth/ └── ...

By default, the remote's default branch (main, master, etc.) is kept. Use --branch to specify a different branch.

HANDLING UNCOMMITTED CHANGES

  • Changes in the target branch's worktree are preserved
  • Other worktrees with uncommitted changes cause the command to fail
  • Use --force to delete dirty worktrees (changes will be lost!)

EXAMPLES

git worktree-flow-eject Eject to the default branch

git worktree-flow-eject -b feature/auth Eject, keeping the feature/auth branch

git worktree-flow-eject --force Eject even if other worktrees have uncommitted changes

Usage

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

Arguments

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

Options

OptionDescriptionDefault
-b, --branch <BRANCH>Branch to keep (defaults to remote's default branch)
-f, --forceDelete worktrees with uncommitted changes (changes will be lost!)
-q, --quietOperate quietly; suppress progress reporting
-v, --verboseBe verbose; show detailed progress
--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.