Skip to content

Instantly share code, notes, and snippets.

@aliyeysides
Created October 18, 2023 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aliyeysides/0dd7aa2ec95354eac725faf191fc252f to your computer and use it in GitHub Desktop.
Save aliyeysides/0dd7aa2ec95354eac725faf191fc252f to your computer and use it in GitHub Desktop.
Git Worktree cheatsheet

Setup git bare repo

git clone --bare <repo_url> <local_repo_name>

git config remote.origin.fetch 'refs/heads/*:refs/heads/*' 

git fetch

List worktrees

git worktree list

Add worktree from remote branch

git worktree add <branch_name>

Add worktree with new branch

git worktree add -b <new_branch_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment