Zsh
zsh git 命令自動完成向 git 分支名稱添加額外的來源
在本地複製 git 儲存庫後,我想將分支切換到“ABCD”。
$ git branch -a * master remotes/origin/ABCD remotes/origin/HEAD -> origin/master remotes/origin/master $ git checkout origin/ABCD #### <- Here is the problem! Note: checking out 'origin/ABCD'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b new_branch_name HEAD is now at f2bf54a... Clean up README.md
當我在 之後按 tab 時
git checkout
,出於某種原因,自動完成總是以detached HEAD狀態origin/
的警告消息開始。如何使自動完成不在開頭添加“來源”?
我找到了一個很棒的外掛供
zsh
你使用。如果您正在使用oh-my-zsh
它,gitfast
或者如果只是使用,zsh
那麼您可以按照他的部落格文章中的說明進行操作。正如作者詳述的那樣,實際上存在相當多的
git
完成問題,他的努力是為了解決所有問題。這是一個問題,現在就像在 bash 中一樣。https://felipec.wordpress.com/2013/07/31/how-i-fixed-git-zsh-completion/
要啟用
oh-my-zsh
編輯您的.zshrc
並更改外掛行以添加 gitfast 像這樣plugins=(git gitfast)