嘗試創建 git 別名alias gpo = "git push origin",但似乎沒有__git_complete帶有來源的 for git push,__git_complete gpo _git_push想要自動完成來源,即使它包含在別名中。
uj5u.com熱心網友回復:
這對我有用(完整的參考資料——本地和遠程分支,以及標簽):
alias gpo="git push origin"
_gpo_comp_refs() {
__load_completion git
local cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=(`compgen -W "$(__git_refs)" -- "$cur"`)
}
complete -F _gpo_comp_refs gpo
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/521449.html
