Git 如何使bash完成在windows10bash中使用别名?

Git 如何使bash完成在windows10bash中使用别名?,git,Git,我有一个aliases.sh文件修改为 alias gc='git checkout' 在签出一个长分支名称时,如果我键入 gc+选项卡,“自动完成”不起作用,以便显示完整的分支名称。我查看了中的所有内容,试图使其适用于和定制kpsfoo所说的内容,但适用于Windows 10操作系统 这些步骤将是: 1) 从复制git completion.bash文件 <your git install folder>/etc/git-completion.bash -值得注意的是:alia

我有一个aliases.sh文件修改为

alias gc='git checkout'
在签出一个长分支名称时,如果我键入
gc
+选项卡,“自动完成”不起作用,以便显示完整的分支名称。

我查看了中的所有内容,试图使其适用于和定制kpsfoo所说的内容,但适用于Windows 10操作系统

这些步骤将是:

1) 从复制git completion.bash文件

<your git install folder>/etc/git-completion.bash

-值得注意的是:
alias gm='git merge--no ff'
\u git\u complete gm\u git\u merge
(当键入gm加上分支名称中的字符串并按TAB时,它将自动完成,运行命令后,合并将考虑--无ff规则)

回答得好,请注意
zsh
无需任何手动调整即可工作。在我的Git版本2.28.0.windows.1上,Git-completion.bash位于
/mingw64/share/Git/completion/Git completion.bash
alias ga="git add"
alias gb='git branch'
alias gba="git branch -a"
alias gc='git checkout'
alias gcb='git checkout -b'
alias gcam='git commit -a -m'
alias gm='git merge --no-ff'
alias gps='git push wpdev dev'
alias gpsm='git push wpdev master'
alias gpl='git pull wpdev dev'
alias gplm='git pull wpdev master'
alias st='git status'
alias l='git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit'
alias last='log -1 HEAD'
alias gs='git stash'

# Enable the __git_complete function to autocomplete aliases once you press TAB
source ~/git-completion.bash

__git_complete ga _git_add
__git_complete gc _git_checkout
__git_complete gm _git_merge
__git_complete gb _git_branch
__git_complete gba _git_branch
__git_complete l _git_log

case "$TERM" in
xterm*)
    # The following programs are known to require a Win32 Console
    # for interactive usage, therefore let's launch them through winpty
    # when run inside `mintty`.
    for name in node ipython php php5 psql python2.7
    do
        case "$(type -p "$name".exe 2>/dev/null)" in
        ''|/usr/bin/*) continue;;
        esac
        alias $name="winpty $name.exe"
    done
    ;;
esac