Skip to content

Unable to change directory on Windows GitBash with chell integration enabled #348

Closed

Description

@NikiforovAll

Hi, thank you for making worktrunk.

I have shell integration installed - https://github.com/NikiforovAll/dotfiles2/blob/main/dot_bashrc#L124. But for some reason, it doesn't work for me. It kinda denies the premise of worktrunk so I really would like to resolve this one :). Thank you!

❯ gwt switch test
▲ Worktree for test @ ~\dev\lazyclaude.test, but cannot change directory — restart the shell to activate

Activity

  1. max-sixty commented on Jan 1, 2026

    @max-sixty
    Owner

    thanks for the issue and the dotfiles link. let me try to repro today

  2. added a commit that references this issue on Jan 1, 2026
    d374e05
  3. max-sixty commented on Jan 2, 2026

    @max-sixty
    Owner

    @NikiforovAll I think the problem is that the git wt cannot change directories, because git is called as a binary, and binaries can't change directories, only shell functions (which is why we need the shell function...)

    The easiest thing to do would be to install wt as git-wt with cargo install wt --features=git-wt, and then change git wt at NikiforovAll/dotfiles2@0f27ff7#diff-e0b0f48ff9e674d431409e77916c55ecd027c260868c012d99e995ae83bc305cR124 to git-wt:

    - if command -v git wt >/dev/null 2>&1; then eval "$(command git wt config shell init bash)"; fi
    + if command -v git-wt >/dev/null 2>&1; then eval "$(command git-wt config shell init bash)"; fi

    As soon as microsoft/winget-pkgs#327395 merges, then the cargo install isn't necessary — it'll install as git-wt

    Does that make sense? Let me know any issues. The messages from wt should now be much clearer, from #362.

  4. NikiforovAll commented on Jan 2, 2026

    @NikiforovAll
    Author

    Unfortunately, it doesn't work.

    ❯ gwt switch -c test
    ◎ Running post-create project hook:
      uv sync
    ✓ Created new worktree for test from main @ ~\dev\lazyclaude.test
    ↳ Run wt config shell install to enable automatic cd

    +Also,

    Image
  5. added a commit that references this issue on Jan 2, 2026
    a18f9a3
  6. max-sixty commented on Jan 3, 2026

    @max-sixty
    Owner

    0.9.0 now has much much better diagnostics for what's going on, inspired by this issue.

    wt config show also gives some details under RUNTIME

    would you mind giving that a go? thanks for your patience @NikiforovAll

  7. NikiforovAll commented on Jan 3, 2026

    @NikiforovAll
    Author
    Image Image Image

    no worries

  8. added 4 commits that reference this issue on Jan 3, 2026
    f62adf0
    81077c3
    3398ef9
    f8e1dae
  9. max-sixty commented on Jan 4, 2026

    @max-sixty
    Owner

    0.9.2 should now give better diagnostics on Windows

    Two points:

    • Have a look at wt config show for diags without having to run wt switch etc
    • I think the problem is coming from aliasing with git-wt, but having a wt.exe binary in path. Instead, WinGet now installs a git-wt.exe, so the first block can be a very simple aliasing of gwt to git-wt.exe (but not 100% sure and would like wt to make this transparent itself...)

    thank you again @NikiforovAll !

  10. 16 remaining items

  11. NikiforovAll commented on Jan 6, 2026

    @NikiforovAll
    Author

    on 9.4.0

    Image

    ➕ updated (as part of onboarding flow when failed to cd as part of git switch test):

    last line is auto-generated; I've removed other code that tried to achive similar

    Image
  12. NikiforovAll commented on Jan 6, 2026

    @NikiforovAll
    Author

    New branch:

    Image
  13. max-sixty commented on Jan 6, 2026

    @max-sixty
    Owner

    hmmm...

    • does git-wt switch work?
    • does removing the .exe from the alias command & the eval work?
  14. max-sixty commented on Jan 6, 2026

    @max-sixty
    Owner

    forany future travellers / agents, here is the text of the images above:

    Image 1 (first screenshot in comment 3713651429):

    lazyclaude on % main = took 5.664s
    > gwt switch test
    ◉ Running post-create project hook @ ~\dev\lazyclaude.test:
      uv sync
    Using CPython 3.12.10 interpreter at: C:\Users\nikiforovall\AppData\Local\Programs\Python\Python312\python.exe
    Creating virtual environment at: .venv
    Resolved 38 packages in 0.83ms
        Built lazyclaude @ file:///C:/Users/nikiforovall/dev/lazyclaude.test
    Prepared 1 package in 781ms
    Installed 34 packages in 441ms
     + cfgv==3.5.0
     + colorama==0.4.6
     + distlib==0.4.0
     + filelock==3.20.0
     + identify==2.6.15
     + iniconfig==2.3.0
     + lazyclaude==0.12.10 (from file:///C:/Users/nikiforovall/dev/lazyclaude.test)
     + librt==0.7.0
     + linkify-it-py==2.0.3
     + markdown-it-py==4.0.0
     + mdit-py-plugins==0.5.0
     + mdurl==0.1.2
     + mypy==1.19.0
     + mypy-extensions==1.1.0
     + nodeenv==1.9.1
     + packaging==25.0
     + pathspec==0.12.1
     + platformdirs==4.5.1
     + pluggy==1.6.0
     + pre-commit==4.5.0
     + pyfakefs==5.10.2
     + pygments==2.19.2
     + pyperclip==1.11.0
     + pytest==9.0.1
     + pytest-asyncio==1.3.0
     + pyyaml==6.0.3
     + rich==14.2.0
     + ruff==0.14.8
     + textual==6.7.1
     + types-pyperclip==1.9.0.20250801
     + types-pyyaml==6.0.12.20250915
     + typing-extensions==4.15.0
     + uc-micro-py==1.0.3
     + virtualenv==20.35.4
    ✓ Created worktree for test @ ~\dev\lazyclaude.test
    ▲ Cannot change directory — run C:\Users\nikiforovall\AppData\Local\Microsoft\WinGet\Packages\max-sixty.worktrunk_Microsoft.Winget.Source_8wekyb3d8bbwe\git-wt.exe; shell integration wraps git-wt
    lazyclaude on % main =
    

    Image 2 (second screenshot in comment 3713651429):

    114
    115  ######
    116  # worktrunk
    117  ######
    118
    119  # alias (gwt → dynamic wt.exe to avoid Windows Terminal conflict)
    120  if command -v git-wt.exe &> /dev/null; then
    121      alias gwt="git-wt.exe"
    122  fi
    123
    124  if command -v git-wt >/dev/null 2>&1; then eval "$(command git-wt config shell init bash)"; fi
    125
    

    Image 3 (comment 3713652455):

    lazyclaude on % main =
    > gwt switch -c test2
    ◉ Running post-create project hook @ ~\dev\lazyclaude.test2:
      uv sync
    Using CPython 3.12.10 interpreter at: C:\Users\nikiforovall\AppData\Local\Programs\Python\Python312\python.exe
    Creating virtual environment at: .venv
    Resolved 38 packages in 1ms
        Built lazyclaude @ file:///C:/Users/nikiforovall/dev/lazyclaude.test2
    Prepared 1 package in 806ms
    Installed 34 packages in 406ms
     + cfgv==3.5.0
     + colorama==0.4.6
     + distlib==0.4.0
     + filelock==3.20.0
     + identify==2.6.15
     + iniconfig==2.3.0
     + lazyclaude==0.12.10 (from file:///C:/Users/nikiforovall/dev/lazyclaude.test2)
     + librt==0.7.0
     + linkify-it-py==2.0.3
     + markdown-it-py==4.0.0
     + mdit-py-plugins==0.5.0
     + mdurl==0.1.2
     + mypy==1.19.0
     + mypy-extensions==1.1.0
     + nodeenv==1.9.1
     + packaging==25.0
     + pathspec==0.12.1
     + platformdirs==4.5.1
     + pluggy==1.6.0
     + pre-commit==4.5.0
     + pyfakefs==5.10.2
     + pygments==2.19.2
     + pyperclip==1.11.0
     + pytest==9.0.1
     + pytest-asyncio==1.3.0
     + pyyaml==6.0.3
     + rich==14.2.0
     + ruff==0.14.8
     + textual==6.7.1
     + types-pyperclip==1.9.0.20250801
     + types-pyyaml==6.0.12.20250915
     + typing-extensions==4.15.0
     + uc-micro-py==1.0.3
     + virtualenv==20.35.4
    ✓ Created branch test2 and worktree from main @ ~\dev\lazyclaude.test2
    ▲ Cannot change directory — run C:\Users\nikiforovall\AppData\Local\Microsoft\WinGet\Packages\max-sixty.worktrunk_Microsoft.Winget.Source_8wekyb3d8bbwe\git-wt.exe; shell integration wraps git-wt
    
  15. added 11 commits that reference this issue on Jan 6, 2026
    b33d622
    c6b691c
    e223a36
    1a71272
    9bede32
    fa0b7ef
    be78e4b
    4e1e085
    4bcda22
    205b50d
    73d5327
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions