Setup a folder inside a repo with a specific commit of that repo.
git worktree add [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<commit-ish>]
-f, --force
: Force if is already checked out by another worktree or if is already assigned a worktree.--detach
: to detach the HEAD. (seegit checkout --detach
)--no-checkout
: suppress checkout. (seegit read-tree
Sparse Checkout)--lock
: lock the worktree. (seegit worktree lock
)-b <new-branch>
: Create the branch<new-branch>
from<commit-ish>
or HEAD if none.-B <new-branch>
: Same + force if<new-branch>
already exist and reset branch to<commit-ish>
or HEAD if none.<path>
: Relative or absolute path to the worktree<commit-ish>
: Commit or branch to use as base.
git worktree list [--porcelain]
git worktree lock [--reason <string>] <worktree>
git worktree move <worktree> <new-path>
git worktree prune [-n] [-v] [--expire <expire>]
git worktree remove [-f] <worktree>
git worktree unlock <worktree>