1

I have ML with Xcode installed tools (git coming from there).

Later I've installed brew and install bash-completion, but git commands still not auto-completed.

Brew has no such package. Google does not helped. How I can enable git completion support in Mountain Lion?

2
  • Answers containing just links will automatically be converted to comments. The way it's now is fine. Cheers!
    – slhck
    Commented Sep 18, 2012 at 9:50
  • questions like these really belong on ask different, the apple stack exchange site, at apple.stackexchange.com
    – JamiePatt
    Commented Sep 18, 2012 at 11:08

1 Answer 1

3

SOLVED:

I've found solution here: https://apple.stackexchange.com/questions/55875/how-can-i-get-git-to-autocomplete-e-g-branches-at-the-command-line and it works well.

I got that by using curl from the URL here:

curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Then I added to my ~/.bash_profile file the following "execute if it exists" code:

if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash; fi

5
  • +1 - Don't reply to this comment, I will delete it but that is a good answer!
    – Dave
    Commented Sep 18, 2012 at 9:41
  • 2
    That should be -o ~/.git-completion.bash instead of -o /.git-completion.bash Commented Nov 16, 2012 at 16:46
  • Also, there needs to be a ; before the fi
    – SooDesuNe
    Commented Mar 14, 2013 at 20:23
  • I would suggest changing the URL to https://raw.githubusercontent.com/git/git/v1.8.5.2/contrib/completion/git-completion.bash in order to grab the completion script matching ML's Git version (1.8.5.2). Commented Jul 29, 2014 at 2:00
  • Strangely, a Zero Width Non-Joiner character (U+200C) got inserted in the middle of the URL in my last comment. Try the URL of this link instead: github/git/git/v1.8.5.2/contrib/completion/git-completion.bash. Commented Jul 29, 2014 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .