Git worktree like a boss
If there’s one Git tool that few people know about, it’s “worktree.” Once you’ve mastered this tool, you’ll find it incredibly hard to do without it. But you have to use it the right way. Here’s a ...

Source: DEV Community
If there’s one Git tool that few people know about, it’s “worktree.” Once you’ve mastered this tool, you’ll find it incredibly hard to do without it. But you have to use it the right way. Here’s a method I’ve been using for a very long time TL;DR In an empty directory: # 1. Clone the repo into a hidden .bare folder git clone --bare [email protected]:user/repo.git .bare # 2. Tell the root folder where the Git history is hidden echo "gitdir: ./.bare" > .git # 3. Fix the fetch configuration to see all remote branches git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" # 4. Create your first worktree (the main branch) git worktree add main git worktree add <name of the branch> # Each folder correspond to a branch, everything is centralized # Read the doc... or follow the article I provide you a script you can put in your PATH to ease the process. Take a look at the end of the article. First of all, what is a “worktree”? In the fast-paced world of software development