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
gtr binary and shell function conflict with coreutils (GNU tr) #124
Two related issues when using git-gtr on a system with GNU coreutils installed via Homebrew.
Issues
1. gtr binary conflicts with coreutils
brew install coreutils provides /opt/homebrew/bin/gtr (GNU tr). Installing git-gtr via Homebrew fails to link because of this conflict:
$ brew link git-gtr
Error: Could not symlink bin/gtr
Target /opt/homebrew/bin/gtr
is a symlink belonging to coreutils.
This causes brew link to fail entirely, which also prevents the zsh/bash/fish completion files from being symlinked.
2. git gtr init zsh shadows coreutils gtr
Even without the binary conflict, eval "$(git gtr init zsh)" defines a gtr() shell function that shadows the coreutils gtr command. Additionally, gtr cd <tab> doesn't complete worktree names since cd is not listed in the completion file.
Workaround
My current workaround is to skip git gtr init zsh and define a custom function with completions (which gtr cd is currently missing):
ifcommand -v git-gtr &> /dev/null;thenfunctiongcd {
local dir
dir="$(git gtr go "$@")"&&cd"$dir"
}
function_gcd {
local -a worktrees
worktrees=("1"${(f)"$(git gtr list --porcelain 2>/dev/null | cut -f2)"})
_describe 'worktrees' worktrees
}
compdef _gcd gcd
fi
Suggested fixes
Consider removing the gtr shorthand binary — git gtr already works as a git subcommand, and the shorthand conflicts with coreutils. The shell init could alias it for users who want it.
Consider adding cd to the completion file, and using git gtr list --porcelain instead of git branch for worktree name completions
Thanks for the detailed report @fmal — all three issues are addressed in #125:
1. Homebrew binary conflict → fixed
The binary relationship is reversed: bin/git-gtr is now the main entry point (sources libs, contains main()), and bin/gtr is just a thin convenience wrapper. This means the Homebrew formula can drop bin.install "bin/gtr" entirely — no more conflict with coreutils. A follow-up PR to the tap repo will make that change.
2. Shell function shadows coreutils → --as flag
git gtr init now accepts --as <name> to choose a custom function name:
eval"$(git gtr init zsh --as gwtr)"
gwtr cd my-feature # no conflict with GNU tr
gwtr list # passes through to git gtr
The default remains gtr for backwards compatibility, but users with coreutils can pick any valid identifier.
3. cd completions → added
The init output now includes proper cd completions for all three shells. Worktree names are completed using git gtr list --porcelain (shows only actual worktrees, not all branches). The special ID 1 (main repo) is also included.
This should match the experience you described in your workaround, but built-in.
I just tried to install gtr and hit the same issue. brew link fails and git-gtr is not in PATH. I think the homebrew formula needs updating as @fmal suggests?
To get it working with git i had to manually symlink:
Activity
fix: resolve gtr/coreutils naming conflict and add cd completions
helizaga commentedon Feb 13, 2026
Thanks for the detailed report @fmal — all three issues are addressed in #125:
1. Homebrew binary conflict → fixed
The binary relationship is reversed:
bin/git-gtris now the main entry point (sources libs, containsmain()), andbin/gtris just a thin convenience wrapper. This means the Homebrew formula can dropbin.install "bin/gtr"entirely — no more conflict with coreutils. A follow-up PR to the tap repo will make that change.2. Shell function shadows coreutils →
--asflaggit gtr initnow accepts--as <name>to choose a custom function name:The default remains
gtrfor backwards compatibility, but users with coreutils can pick any valid identifier.3.
cdcompletions → addedThe init output now includes proper
cdcompletions for all three shells. Worktree names are completed usinggit gtr list --porcelain(shows only actual worktrees, not all branches). The special ID1(main repo) is also included.This should match the experience you described in your workaround, but built-in.
fix: resolve gtr/coreutils naming conflict and add cd completions (#125)
fmal commentedon Feb 13, 2026
@helizaga awesome!! ❤️ thanks so much for addressing this so quick, can't wait to update! 🚀
helizaga commentedon Feb 17, 2026
just cut a release!
fmal commentedon Feb 18, 2026
@helizaga thanks! works like a charm 💯 could you also drop
bin.install "bin/gtr"in the homebrew formula?WickyNilliams commentedon Mar 9, 2026
I just tried to install gtr and hit the same issue.
brew linkfails andgit-gtris not in PATH. I think the homebrew formula needs updating as @fmal suggests?To get it working with git i had to manually symlink:
which feels extremely hacky!
nkovacic commentedon Mar 10, 2026
Had the same issue, reverted to git clone install (without Brew).
nkovacic commentedon Apr 9, 2026
@helizaga Any update on this issue? It is still happening and making the rollout of git-gtr as the main git worktree utility more difficult on MacOS.