Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git worktree

Manage multiple working trees

Syntax

git worktree <subcommand> [options]

Common Options

OptionDescription
add <path> [<branch>]Add new worktree
add -b <branch> <path>Add worktree with new branch
listList all worktrees
remove <path>Remove worktree
prunePrune deleted worktree records
lock <path>Lock worktree
unlock <path>Unlock worktree

Examples

git worktree add ../project-hotfix hotfix

Add worktree for hotfix branch

git worktree list

List all worktrees

git worktree add -b emergency-fix ../project-emergency

Add worktree with new branch

git worktree remove ../project-hotfix

Remove worktree

Related Tools

More Code & Dev Tools