Skip to content

Prompt does not recognize directory as git repo after git worktree move until shell is reloaded #2947

Description

@christowiz

Description

After running git worktree move and navigating into the new directory, the prompt shows no git information — the directory is not recognized as a git repo. This persists until the shell is fully reloaded (exec zsh or omz reload).

This is unexpected because navigating into any other git repo directory (including other worktrees that were not moved) works correctly.

Environment

  • Shell: oh-my-zsh
  • Theme: powerlevel10k
  • Repo setup: bare repo with linked worktrees

Steps to Reproduce

  1. Set up a bare repo with one or more linked worktrees
  2. Navigate into a worktree — prompt displays git info correctly
  3. Run git worktree move <old-path> <new-path>
  4. Navigate into

Expected Behavior

Prompt recognizes the directory as a git repo and displays git status, the same as navigating into any other git repo directory for the first time.

Actual Behavior

Prompt displays no git information. The directory is not recognized as a git repo.

Verification That Git Is Healthy

Running the following inside returns correct output — git itself is
functioning normally after the move:

$ cat .git
gitdir: /path/to/repo/.bare/worktrees/<name>
$ git rev-parse --git-dir
/path/to/repo/.bare/worktrees/<name>
$ git rev-parse --show-toplevel
/path/to/repo/<new-path>

Workaround

exec zsh or omz reload

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions