How to create a worktree in Git?

Photo by Nick Fewings on Unsplash

Sometimes, we may want to run the same Git project in 2 separate folders. This is when git worktree comes to the rescue:

git worktree add ../project-worktree v2 # v2 is branch name and ../project-worktree is the new git-project-folder

To remove the worktree, simply:

git worktree remove ../project-worktree
  Edit   Read On GitHub

Phone

Address

Doddanekundi
Bangalore, KA 560037
India