Last active
August 10, 2022 04:42
-
-
Save johngibb/972430 to your computer and use it in GitHub Desktop.
Mac OS X - Install Git Completion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!" |
NM. I recently added a .bash_profile file which is now running instead of my .profile script. http://stackoverflow.com/questions/18773051/how-to-make-os-x-to-read-bash-profile-not-profile-file
I added "source ~/.profile" to .bash_profile and everything is happy again.
And the git completion is working. :)
You'll need to add -L to the curl command to follow redirect now
Thanks! I am glad I found this one! I have tried so many links, this one finally make the autocompletion work!
Thanks worked for me on Mac.
Thanks working fine on Mac, i was having issue but corrected it.
Thank you !
works on mac
Thank you!
It works for me on mac.
Thanks! This works on OSX high sierra too.
works well, ty!
Very cool, thanks for the information :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@johngibb I ran this code and now my .profile script doesn't source when I open terminal. Any ideas? It works when I source it manually but it isn't doing it automatically anymore.