事象
VSCode経由でgit for Windowsのbashを叩いていた際に、以下の様なエラーメッセージが発生する。
$ ps auxww PID PPID PGID WINPID TTY UID STIME COMMAND 1510 1481 1510 13484 cons0 197609 10:38:59 /usr/bin/sh 1515 1510 1515 17064 cons0 197609 10:39:18 /usr/bin/ps 1481 1 1481 26804 cons0 197609 10:38:16 /usr/bin/bash sh: __git_ps1: command not found
対処方法
C:\Program Files\Git\etc\profile.d配下のgit-prompt.shを以下の様に入れ替えた。
変更前
(中略) . "$COMPLETION_PATH/git-prompt.sh" . "$COMPLETION_PATH/git-completion.bash"
変更後
(中略) . "$COMPLETION_PATH/git-completion.bash" . "$COMPLETION_PATH/git-prompt.sh"
結果、エラーメッセージが表示されなくなった。
(中略) sh: __git_ps1: command not found $ bash ← git-prompt.shを読み込み直すために打った $ ps auxww PID PPID PGID WINPID TTY UID STIME COMMAND 1545 1510 1545 19052 cons0 197609 13:08:01 /usr/bin/bash 1532 1 1532 284 cons1 197609 13:07:42 /usr/bin/bash 1510 1481 1510 13484 cons0 197609 10:38:59 /usr/bin/sh 1558 1545 1558 27764 cons0 197609 13:08:07 /usr/bin/ps 1481 1 1481 26804 cons0 197609 10:38:16 /usr/bin/bash $ (エラーメッセージ出なくなった)