Created
May 25, 2026 20:20
-
-
Save copyleftdev/96517bb812660ae512d4530691ff385b to your computer and use it in GitHub Desktop.
git worktree — multiple checkouts, one repo
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
| # git worktree — multiple checkouts, one repo | |
| # Run two branches side-by-side without stashing or switching. | |
| git worktree add ../feature-branch feature/my-feature | |
| git worktree add ../hotfix-branch main | |
| # Both share the same .git — no second clone needed. | |
| # List all active worktrees: | |
| git worktree list | |
| # Clean up when done: | |
| git worktree remove ../hotfix-branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment