Homebrew’s `git` not using completion

后端 未结 18 1972
盖世英雄少女心
盖世英雄少女心 2020-12-22 16:25

When using OSX’s git, after I modify a file I can simply do git commit , and that’ll auto complete the file’s name to the one that was modified. Howe

18条回答
  •  离开以前
    2020-12-22 16:55

    If you used homebrew to install git, then probably there is no need to install anything to support git completion. "git-completion.bash" file is somewhere (mine was here: /usr/local/git/contrib/completion/git-completion.bash)

    All you need to do is to find the file: sudo find / -type f -name "git-completion.bash"

    Then source its path in your .bash_profile. For example I needed to add this line to my ~/.bash_profile:

    source /usr/local/git/contrib/completion/git-completion.bash
    

    Don't forget to source your ~/.bash_profile or reopen your terminal ;)

    from: how-enable-git-tab-completion-bash-mac-os-x

提交回复
热议问题