You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Worktrees: branches held by another worktree are unmarked and fail to check out #629
@hannesa2, GitX has no notion of worktrees at all - grep -ri worktree Classes finds nothing. Three things follow from that.
1. A branch checked out in another worktree looks like any other branch. git marks these itself: git branch prints + feature and colors it, and git worktree list gives the full picture. GitX shows it as an ordinary, checkout-able branch. The sidebar already badges HEAD with a checkmark, so there is a natural place for a marker.
2. Checking one out fails, and the message blames the wrong thing. git refuses by design:
fatal: 'feature' is already used by worktree at '/path/to/wt'
NSString *message = [NSStringstringWithFormat:@"There was an error checking out the %@ '%@'.\n\nPerhaps your working directory is not clean?", [ref refishType], [ref shortName]];
So you are told "Perhaps your working directory is not clean?" and go hunting for uncommitted changes that do not exist. git's own text does reach the sheet further down, under "Output:", but the headline contradicts it. The same canned sentence is used for any failure of checkoutFiles:fromRefish: (L966) and cherryPickRefish: (L1007).
3. There is nothing to do about it in the app - no way to see where that worktree is, and no way to open it.
Suggested slices, smallest first:
show git's own message instead of the guess when the task fails. Self-contained, worth doing whether or not the rest happens.
read git worktree list --porcelain (path, HEAD, branch, locked/prunable in one call) and mark branches held by another worktree the way git does
for those branches, replace Checkout with "Open Worktree", opening that path as another GitX document
later: a WORKTREES section in the sidebar next to SUBMODULES, then add/remove
Note objective-git wraps none of this - libgit2 has git_worktree_list, ObjectiveGit never exposed it - but shelling out matches how checkout, stash and the rest already work.
I personally don't use git worktrees at all. If you mean, that it's worth to jump into this: go ahead !
Just in general what I see as a higher goal:
* bump libgit2, I already tried it [Bump libgit2 to 1.0.0 #513](https://github.com/gitx/gitx/pull/513) [Bump libgit2 to 1.8.5 #509](https://github.com/gitx/gitx/pull/509) but I failed
* move step by step into the direction of a full Swift project
Great, so I'll just see if we can have some basic support for git-worktrees (maybe just label them with a different color, to make it clearer in the UI), then try to bump libgit2 and see where it get me...
Status update, since three of the four suggested slices have landed:
Show git's own message instead of the guess - Fix checkout errors blaming the working directory (issue #629) #630 (110ad547). -failureReasonFromTaskError:orFallback: prefers the failed task's own output and falls back to the canned sentence only when git said nothing. It covers all three call sites named above: checkoutRefish:, checkoutFiles:fromRefish: and cherryPickRefish:.
Mark branches held by another worktree - Add basic support for worktree branches (issue #629) #633 (e48132cb, f7470251). git worktree list --porcelain is read once per refs reload, the sidebar swaps in a WorktreeBranch icon for a held branch, and the details page is given the same list.
Replace Checkout with "Open Worktree" - Add basic support for worktree branches (issue #629) #633. For a branch another worktree holds, the contextual menu offers Open Worktree of Branch "name", with the worktree's path as its tooltip, in place of Checkout.
A WORKTREES section in the sidebar, next to SUBMODULES, and add/remove.
Landed on top of those: #656 moved the worktree lookup off the drawing path (#647), so reading it no longer stalls the history while it draws.
That leaves the last bullet as the only open work here. It may be worth splitting it into its own issue: the first three were what made the app actively misleading, while a sidebar section with add and remove is a feature rather than a fix, and keeping this one open makes the fixed parts look unfixed.
The remaining bullet is now #675, so everything tracked here has landed: #630 for the error message, #633 for the marking and the Open Worktree action, and #656 for taking the lookup off the drawing path.
Activity
hannesa2 commentedon Sep 13, 2026
I personally don't use git worktrees at all.
If you mean, that it's worth to jump into this: go ahead !
Just in general what I see as a higher goal:
Fix checkout errors blaming the working directory (issue gitx#629)
goneng commentedon Sep 13, 2026
Great, so I'll just see if we can have some basic support for git-worktrees (maybe just label them with a different color, to make it clearer in the UI), then try to bump libgit2 and see where it get me...
Fix checkout errors blaming the working directory (issue gitx#629)
Tell branches held by another worktree apart (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Fix checkout errors blaming the working directory (issue gitx#629)
Merge pull request #630 from goneng/fix-checkout-error-message
Add basic support for worktree branches (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Keep a branch two worktrees share marked as held (issue gitx#629)
Add basic support for worktree branches (issue gitx#629)
Keep a branch two worktrees share marked as held (issue gitx#629)
Merge pull request #633 from goneng/mark-worktree-branches
goneng commentedon Sep 18, 2026
Status update, since three of the four suggested slices have landed:
110ad547).-failureReasonFromTaskError:orFallback:prefers the failed task's own output and falls back to the canned sentence only when git said nothing. It covers all three call sites named above:checkoutRefish:,checkoutFiles:fromRefish:andcherryPickRefish:.e48132cb,f7470251).git worktree list --porcelainis read once per refs reload, the sidebar swaps in a WorktreeBranch icon for a held branch, and the details page is given the same list.Landed on top of those: #656 moved the worktree lookup off the drawing path (#647), so reading it no longer stalls the history while it draws.
That leaves the last bullet as the only open work here. It may be worth splitting it into its own issue: the first three were what made the app actively misleading, while a sidebar section with add and remove is a feature rather than a fix, and keeping this one open makes the fixed parts look unfixed.
goneng commentedon Sep 18, 2026
The remaining bullet is now #675, so everything tracked here has landed: #630 for the error message, #633 for the marking and the Open Worktree action, and #656 for taking the lookup off the drawing path.
goneng commentedon Sep 18, 2026
Closing: the three slices filed here are done, and the fourth is now tracked in #675.