notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

Worktrees.md (693B)


      1 # Git Worktrees
      2 
      3 **Reference:** [Documentation](https://git-scm.com/docs/git-worktree)
      4 
      5 ## Usage
      6 
      7 Git worktrees allow multiple trees to be attached to the same repository. In essence, this allows for checking out multiple branches concurrently.
      8 
      9 ### Getting Started
     10 
     11 To create a worktree run:
     12 
     13 `git worktree add /path/to/worktree`
     14 
     15 NOTE: This automatically creates a new branch called `worktree` where `worktree` is the final part of the path.
     16 
     17 To list worktrees run:
     18 
     19 `git worktree list`
     20 
     21 To delete a worktree run:
     22 
     23 `git worktree remove /path/to/prune`
     24 
     25 ### Advantages
     26 
     27 The primary reason to use worktrees instead of copying the entire directory is to have synchronization between branches.