Skip to content

Instantly share code, notes, and snippets.

@tusharsnx
Last active July 29, 2025 05:47
Show Gist options
  • Select an option

  • Save tusharsnx/3b1999dcae63b4e1cac99f407130b952 to your computer and use it in GitHub Desktop.

Select an option

Save tusharsnx/3b1999dcae63b4e1cac99f407130b952 to your computer and use it in GitHub Desktop.
VSCode git worktree issue repro
set -e
mkdir worktree-repro
cd worktree-repro
# Initialize bare repo inside `.bare`
git --bare init .bare
# Create a .git file to help `git` access the actual .git dir (= .bare)
echo 'gitdir: ./.bare' > .git
# Fix for git remote fetches
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
# Create two worktree "main" and "fix"
git worktree add main
# Create a commit on main
cd main
echo 'This is an autogenerated text' > test-file.txt
git add .
git commit -m "initial commit"
# Go back to the repo's root
cd ..
# Add another worktree: fix
git worktree add fix
# Create a commit on fix
cd fix
echo 'Fix: This is an autogenerated text' > test-file-fix.txt
git add .
git commit -m "initial commit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment