Files
Advanced-Git/contents/create-a-new-worktree.md
2025-07-26 07:49:48 +00:00

1022 B

⬅️ Back to How to Use git worktree Safely

⬆️ Previous Step: Check Existing Worktrees

Create a New Worktree

Category: Worktree

Command

git worktree add <path> <branch>

Examples

  • Create a new worktree for the feature branch.
git worktree add ../feature-branch feature 
  • Create a worktree for a hotfix branch.
git worktree add ../hotfix hotfix-branch 

Steps

  1. Create a worktree linked to a specific branch.

Prerequisites

  • The target path must not already be a git repository.

➡️ See the Next Step: Remove a Worktree


Author: mike-rambil • Updated: 2024-06-10 • Tags: worktree, add