Last active
July 29, 2025 05:47
-
-
Save tusharsnx/3b1999dcae63b4e1cac99f407130b952 to your computer and use it in GitHub Desktop.
VSCode git worktree issue repro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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