I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts.
For anyone interested in a maintained ready-made solution, install https://github.com/ohmyzsh/ohmyzsh - it has a git plugin turned on by default. I was looking for sth like this - no-brainer pre-created configuration, works nice.