Skip to content

Instantly share code, notes, and snippets.

@johngibb
Last active August 10, 2022 04:42
Show Gist options
  • Star 67 You must be signed in to star a gist
  • Fork 38 You must be signed in to fork a gist
  • Save johngibb/972430 to your computer and use it in GitHub Desktop.
Save johngibb/972430 to your computer and use it in GitHub Desktop.
Mac OS X - Install Git Completion
URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi
SOURCE_LINE="source ~/.git-completion.bash"
if [[ -f "$PROFILE" ]] && grep -q "$SOURCE_LINE" "$PROFILE"; then
echo "Already added to bash profile."
else
echo "Adding to bash profile..."
echo "$SOURCE_LINE" >> "$PROFILE"
fi
echo "Reloading bash profile..."
source "$PROFILE"
echo
echo "Successfully installed."
echo "Git auto-completion should be all set!"
@Maxon4eg
Copy link

Thank you !
works on mac

Copy link

ghost commented Jan 18, 2018

Thank you!
It works for me on mac.

@dnlglsn
Copy link

dnlglsn commented Feb 1, 2018

Thanks! This works on OSX high sierra too.

@A6Brgeuka
Copy link

works well, ty!

@HerbertKoelman
Copy link

Very cool, thanks for the information :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment