Skip to content

Instantly share code, notes, and snippets.

@dc0d
Created March 14, 2023 08:11
Show Gist options
  • Save dc0d/0625a9390917d02b8e71bd91aedfa474 to your computer and use it in GitHub Desktop.
Save dc0d/0625a9390917d02b8e71bd91aedfa474 to your computer and use it in GitHub Desktop.
git worktree
workspace <- just a plain directory
├── main  <- main checkout
├── branch1
├── branch2
└── branch3

list of worktrees

git worktree list

add a new worktree and a new branch (with the same name) - we are inside the main directory

git worktree add ../branch4

add a new worktree and checkout an existing branch

git worktree add ../some-worktree some-existing-branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment