# Find the right dev server by git branch Source: https://portlivo.com/features/git-branches · Updated 2026-11-15 Two worktrees of the same app, both running `npm run dev`: one on 3000, one on 3001, both called `node`. Which one is the checkout fix? **In short:** Every server shows its repo and branch, read from `.git/HEAD`, so `shop on main` and `shop on fix/checkout` are easy to tell apart. Worktrees of one repo sit next to each other, and servers whose folder is gone move into a **Leftover** section with **Stop All**. ## How it knows the branch On each scan, Portlivo reads `.git/HEAD` in the server’s working folder or the nearest folder above it. A worktree’s `.git` file points back to its main repo, so the row is named after the repo, not the worktree folder. A detached HEAD shows its short commit hash. Switch branches and the row updates on the next scan. ## Using it - Rows from worktrees of one repo stay side by side, each with its branch. - Type a branch or repo name in the search box to filter to it. - Click the branch in the inspector to open the project in VS Code, Cursor or Zed. ## Servers a deleted worktree left behind `git worktree remove` deletes the folder but leaves its dev server running. Servers whose project folder is gone move into their own **Leftover** section at the top of the panel, with **Stop All**, which stops only those. More in [dev servers in git worktrees](https://portlivo.com/guides/dev-servers-git-worktrees). ## Worktrees made by agents Claude Code and Codex often work in their own worktree. Their servers also get the agent’s badge (see [AI agent servers](https://portlivo.com/features/ai-agents)), and through the [MCP server](https://portlivo.com/features/mcp) an agent sees each server’s repo, branch and whether it’s left over. ## Questions people ask **Does it run git?** No. It reads `.git/HEAD` directly, so it’s fast and works without git on your PATH. **Does it give each worktree its own port?** No, ports are still up to your dev server. Give each worktree its own with `--port` or `PORT=`; the [worktrees guide](https://portlivo.com/guides/dev-servers-git-worktrees) shows how.