El autocompletado de Git no funciona con homebrew

He aquí mi arreglo:

brew install git bash-completion
Warning: git-2.1.3 already installed
Warning: bash-completion-1.3 already installed

En .bash_perfil:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
fi

Pero todavía no tengo el autocompletado para los comandos de git. (Usé macports antes, pero lo eliminé por completo porque no podía hacer que los comandos de git se autocompletaran sin importar lo que intentara).

Estoy en OSX 10.10

Respuestas (3)

Para Yosemite, después de actualizar a git 2.1.3 con homebrew, esto funcionó en mi .profilearchivo ( .bash_profileo similar también funcionaría):

# git tab completion (homebrew)
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
    . `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi

Solía ​​tener git-prompt.shallí, pero cambiarlo a git-completion.bashfuncionó para mí. mmmv.

Intente descargar directamente en su directorio de inicio:

curl -O https://raw.github.com/git/git/master/contrib/completion/git-completion.bash
mv git-completion.bash .git-completion.bash

Luego en tu .bash_profileagrega lo siguiente:

if [ -f ~/.git-completion.bash ]; then
    . ~/.git-completion.bash
fi
Hizo esto wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash && source git-completion.bash, sin suerte todavía.
@qed, ese + .bash_profile de respuesta funcionó para mí.
Incluso . ~/.git-completion.bashdirectamente en el caparazón no funciona. Tampoco hay mensaje de error.

En mi sistema (10.10.5), arreglé esto creando un enlace simbólico en /usr/local/etc/bash_completion.d/ a bash_completion.d/git-completion.bash en el directorio GIT. En mi caso:

cd /usr/local/etc/bash_completion.d
ln -s ../../Cellar/git/2.7.2/etc/bash_completion.d/git-completion.bash git-completion.bash

asegúrese de verificar su versión instalada de git y reemplace 2.7.2 con su versión.

Ya lo tengo, pero sigue sin funcionar.
Junto con las otras respuestas, hacer esto también funcionó para mí. ¡Gracias!