简体   繁体   English

如何在使用“git checkout”时将 zsh 配置为自动完成分支名称?

[英]How can I configure zsh to autocomplete branch names while using 'git checkout'?

When I say 'git checkout ' I want zsh to autocomplete names of my git branches.当我说“git checkout”时,我希望 zsh 自动完成我的 git 分支的名称。 Is that possible?那可能吗?

The easiest way (and probably the only one not requiring a serious amount of hacking) is to update zsh.最简单的方法(可能也是唯一不需要大量黑客攻击的方法)是更新 zsh。 On my zsh 4.3.9 autocompletion works for git branches.在我的zsh 4.3.9自动完成功能适用于 git 分支。

I got git autocomplete to work in zsh by adding this to my .zshrc :通过将其添加到我的.zshrc我让 git autocomplete 在 zsh 中工作:

autoload -Uz compinit && compinit

Credit: https://stackoverflow.com/a/67627099/480608信用: https : //stackoverflow.com/a/67627099/480608

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM