Why doesn't __git_ps1 work in bash anymore on OSX with MacPorts?

2

1

After updating Macports today, I get -bash: __git_ps1: command not found.

Why is that?

Ramon de la Fuente

Posted 2014-06-16T14:07:43.387

Reputation: 161

Answers

4

Macports has updated the old port called git-core to just git. When updating your ports (port upgrade outdated), this will automatically happen.

But: if you used the old git-prompt.sh file in your .profile, you will now get the message -bash: __git_ps1: command not found.

This is because the path of the file has changed. You should update your .profile to look like this:

if [ -f /opt/local/share/git/contrib/completion/git-prompt.sh ]; then                                                                                         
. /opt/local/share/git/contrib/completion/git-prompt.sh
fi

Ramon de la Fuente

Posted 2014-06-16T14:07:43.387

Reputation: 161

Alternatively, symlinking the git-prompt.sh in the folder /opt/local/share/bash-completion/completions/ should work – Ramon de la Fuente – 2014-06-16T14:10:54.000

There is also an answer on StackOverflow

– mtak – 2014-06-16T14:26:16.613