Homebrew’s `git` not using completion

后端 未结 18 1979
盖世英雄少女心
盖世英雄少女心 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:36

    For me , I had to put

    source $(brew --prefix)/etc/bash_completion
    

    into .bashrc (not .bash_profile) to get this to work.

    ".bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells" -- from What is the difference between .bash_profile and .bashrc? It appears to me that MacOS Sierra doesn't execute .bash_profile when opening a new terminal window, only .bashrc.

    I wouldn't put it in _bash_profile, because then I'd have to reboot/logout for updates to take effect.

提交回复
热议问题