mirror of
https://github.com/mike-rambil/Advanced-Git.git
synced 2025-12-21 09:30:03 -06:00
1022 B
1022 B
⬅️ Back to How to Use git worktree Safely
⬆️ Previous Step: Check Existing Worktrees
Create a New 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
- 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