'Git tab completion stopped working on remote branches
I've updated git to its latest version (2.29.0) and I'm using ZSH 5.8.
I used to switch between branches with git checkout remote_br<tab>
to quickly switch between branches, even if the branch is only a remote one atm. I've seen git has made a lot of changes regarding switch/checkout recently, the thing is my autocompletion on remote branches doesn't work anymore (with checkout or switch).
I've tried to add the latest version of contrib/completion/git-completion.zsh
to my zsh, but I still have my issue. Am I missing something here ?
Solution 1:[1]
Try the following patch:
--- a/git-completion.zsh
+++ b/git-completion.zsh
@@ -97,6 +97,11 @@ __gitcomp_direct ()
compadd -Q -S '' -- ${(f)1} && _ret=0
}
+__gitcomp_direct_append ()
+{
+ __gitcomp_direct "$@"
+}
+
__gitcomp_nl ()
{
emulate -L zsh
In general it's better to report bugs to the git mailing list, however, I'm the maintainer of the zsh code, which is more up to date in my fork: git-completion.
Solution 2:[2]
I've been looking into this for the last few hours and have identified the regression.
The regression occurs in 6880779.
To temporarily resolve this: replace your git-completion.bash
file (mine's located at /usr/local/share/zsh/site-functions/git-completion.bash
) with https://github.com/git/git/blob/688077910bdfbd502cb59c9c48a2af2c97d8b67b~1/contrib/completion/git-completion.bash
To really resolve this, upvote my git PR and help get it merged! (https://github.com/git/git/pull/902)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | FelipeC |
Solution 2 |