git-flow-completion
git-flow-completion copied to clipboard
git-completion, OS X, Homebrew instructions
For more recent versions of git (installed via brew), the shell script should be:
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi
Does not work on my macOS Sierra with Git version 2.9.3 (Apple Git-75). I get errors:
-bash: __git_find_subcommand: command not found
-bash: __gitcomp: command not found
WEll for me there is just nothing. So i added the git-flow-completion.bash into /etc/bash_completion.d folder.
i added this script to my .bash_profile
if [ -f `brew --prefix`/etc/bash_completion.d/git-flow-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-flow-completion.bash
fi
then reload bash
source ~/.bash_profile
Then what ? No auto completion at all! What am i missing ?
@erikhuizinga @manodupont My suggestion only works when you install git via brew. (I recommended installing it via brew because you can get the latest version easier.)
I did that too.
Sent from my iPhone
On Apr 7, 2017, at 11:32, Thomas <[email protected]mailto:[email protected]> wrote:
@erikhuizingahttps://github.com/erikhuizinga @manoduponthttps://github.com/manodupont My suggestion only works when you install git via brew. (I recommended installing it via brew because you can get the latest version easier.)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/bobthecow/git-flow-completion/issues/46#issuecomment-292569505, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHN6oZtY5blTWeVtBS9xnhp3PqsHt0z-ks5rtlcBgaJpZM4ID1JV.
When installed with brew the full path should be: /usr/local/etc/bash_completion.d/git-flow-completion.bash
. It should be installed there when you install git (via brew).
Me too after all hassle. Brew update and brew install git and brew upgrade truly work magically!
On Fri, 7 Apr 2017, 18:20 Thomas, [email protected] wrote:
When installed with brew the full path should be: /usr/local/etc/bash_completion.d/git-flow-completion.bash. It should be installed there when you install git (via brew).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bobthecow/git-flow-completion/issues/46#issuecomment-292582215, or mute the thread https://github.com/notifications/unsubscribe-auth/ASeikK1Ric6cpuJcJ0Ml8nt3hy_5Z4HQks5rtmI9gaJpZM4ID1JV .
I was able to fix this by relinking the newest.
brew install git && brew link --overwrite git
I had to brew uninstall git
then brew install git
, perhaps because git was installed before bash_completion and there were no updates to pick up.
I just made it work!
First install with brew bash-completion just running brew install bash-completion
Then download this two files git-completion.bash git-flow-completion.bash
Now copy them to the folder BREW_PREFIX/etc/bash_completion.d/
typically BREW_PREFIX is /usr/local
but you can figure out which one is yours just running the command brew --prefix
And lastly copy this instructions to your ~/.profile
file
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ -f $(brew --prefix)/etc/bash_completion.d/git-completion.bash ]; then
. $(brew --prefix)/etc/bash_completion.d/git-completion.bash
fi
if [ -f `brew --prefix`/etc/bash_completion.d/git-flow-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-flow-completion.bash
fi
Close the terminal or source the .profile file to enable autocompletion And now you can use tab to autocomplete commands on git
@dnetix Your solution worked for me too (Sierra 10.12.6) How comes those files are not downloaded automatically by bash though?
@dnetix Thank you!!! Finally works. I'd been trying half-heartedly to get this working for a couple months and kept giving up.
@dnetix Many thanks for your solution. It works great. I've been annoyed by this Git-cannot-autocomplete for about 3 months after starting my journey on Mac OS (Sierra 10.12.6 + Git 2.14.3).
By the way either 'source ~/.bash_profile' or 'exec -l $SHELL' enables the autocompletion.
another update to this little gem. thanks
Thank you soooo much @dnetix. Finally it works!!!!
My usage
-
brew install bash bash-completion@2
and set it as my shell - put completion script to
~/.local/share/bash-completion/completions/<command_name>
for lazy loading- the script is not loaded until I TAB on the command
- use a jumper script if needed
e.g. a jumper script
# file: ~/.local/share/bash-completion/completions/git
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
fi
@dnetix thank you for your solution.It works for me.
+1 hat tip for this 👌
+1 - ty @dnetix !!
finally!!! Thank you @dnetix
Thank you @dnetix! This worked great for me on OS Catalina 10.15.1
Nono of the above worked for me :(
I am using macOS Catalina version 10.15.7 (19H114)
@dnetix your solution gives me this error /usr/local/etc/bash_completion:1577: command not found: complete
when running source ~/.bash_profile
Anyone can help?
This is quite ancient -- the .bash script is now considered deprecated, apparently -- zsh is now the default terminal on OSX it seems.