Skip to content

Worktrees no longer using branch name in version 1.107.0 #283700

Closed

Description

@jacksen-honey

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.107.0
  • OS Version: OS X 26.1

When creating a new worktree, the tree would adopt the name of the branch. When upgrading from 1.106.3 to 1.107.0, worktrees are now named "worktree-{ISO timestamp}". This does not occur when creating a new branch, only when creating a worktree for an existing branch

Steps to Reproduce:

  1. Initialise a new git repo
  2. Create a new branch (xyz)
  3. Create a worktree using the Git menu

The worktree will be called and placed into a folder named worktree-{timestamp}

Steps that won't reproduce:

  1. Initialise a new git repo
  2. Use the create worktree flow to simultaneously create a branch

In the image, the first branch is opening an existing branch, second branch was created when adding the worktree. If I close and reopen it, it'll end up with a similar name

Image

Activity

  1. aurelticot commented on Dec 16, 2025

    @aurelticot

    I also moticed a change of behaviour on the worktree creation via the UI.

    My workflow used to be:

      1. Repository (ex: my-repo) > Create worktree...
      1. Select the branch (local or remote), ex: feature-01
      1. Select the folder (pre-filled with previous base path + the branch name), ex: ../my-repo.worktrees/feature-01
      1. VS Code / git creates the worktree
      1. Worktree available, ex: at ../my-repo.worktrees/feature-01

    After the VS Code recent update (1.107.0), VS Code seems to add the fodler level worktree-{timestamp} and put the worktree there, ex: ../my-repo.worktrees/feature-01/worktree-{timestamp} as well as create a branch worktree-{timestamp} for it.

    I have two issue with this new behaviour:

    • I already selected a branch for the worktree, I don't need another one
    • In the Repositories view, it's not possible to identify the worktrees anymore, they are all named the same worktree-{timestamp}.

    Note: I don't have any extensions related to worktree AFAIK and no git pre-hook.


    EDIT: Looks like a bug, the code shows the timestamp syntax is only a fallback if branch is undefined, so the question is why branch is undefined even if one was selected?

    if (branch === undefined) {
    // Generate branch name if not provided
    worktreeName = await this.getRandomBranchName();
    if (!worktreeName) {
    // Fallback to timestamp-based name if random generation fails
    const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
    worktreeName = `worktree-${timestamp}`;
    }
    branch = `${branchPrefix}${worktreeName}`;
    // Append worktree name to provided path
    if (worktreePath !== undefined) {
    worktreePath = path.join(worktreePath, worktreeName);
    }
    } else {
    // Extract worktree name from branch
    worktreeName = branch.startsWith(branchPrefix)
    ? branch.substring(branchPrefix.length).replace(/\//g, '-')
    : branch.replace(/\//g, '-');
    }

  2. added
    git
    bug
    on Dec 16, 2025
  3. lszomoru commented on Dec 16, 2025

    @lszomoru
    Member

    This is a regression. I will investigate this today and will try to push a fix that will be available in VS Code Insiders tomorrow.

  4. added
    unreleased
    on Dec 16, 2025
  5. lszomoru commented on Dec 16, 2025

    @lszomoru
    Member

    A fix for this regression will be available in tomorrow's Insiders release so I would appreciate it you could verify it. Thanks!

  6. added
    insiders-released
    and removed
    unreleased
    on Dec 16, 2025
  7. jacksen-honey commented on Dec 17, 2025

    @jacksen-honey
    Author

    Looks fixed, thanks!

  8. jacksen-honey commented on Dec 17, 2025

    @jacksen-honey
    Author

    One small thing, it seems the worktree path doesn't "stick" when you change it

    i.e. by default it's {project}/{project}.worktrees/{branch}, but if I change it to {project}/{branch} it goes back to suggesting the default path on the new worktree. Before it'd offer to create it in the directory the last tree was created

  9. lszomoru commented on Dec 17, 2025

    @lszomoru
    Member

    jacksen-honey, please file a separate issue for that. Thanks!

  10. added
    verified
    author-verification-requested
    on Jan 6, 2026
  11. locked and limited conversation to collaborators on Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

author-verification-requestedbuggitinsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions