git worktree list

Show all worktrees linked to the current Git repository and their paths.

This command is useful when you use multiple working directories for the same Git repository, because it shows you every existing worktree, where it lives on disk, and which branch or commit it is using.

This command lists all worktrees attached to the current repository, showing the main worktree first and then any additional ones, along with each worktree’s filesystem path, whether it is the main worktree, and which branch or commit is checked out there; it has no flags or parameters by default, but you can combine it with other git worktree subcommands such as git worktree add to create a new worktree, git worktree remove to delete one, or git worktree lock and git worktree unlock to prevent or allow removal of a specific worktree.

You can also use related variants like git worktree list --porcelain to get a machine-readable output format (useful in scripts), or git worktree add <path> <branch> to create a new worktree at <path> checked out at <branch>, and then run this command again to verify that the new worktree was added; together, these commands let you manage multiple parallel checkouts of the same repository for tasks like working on several features or releases at once without constantly switching branches.

Examples:

  • git worktree list --porcelain
  • git worktree add ../repo-feature-xyz feature/xyz
  • git worktree remove ../repo-feature-xyz

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...