TIL: How to speed up git status in your Bash prompt
Bash prompt
A while ago I wrote about how to customize your terminal prompt with Bash only:
In order to get your git status displayed in the prompt, I turned to the official git-prompt.sh
shell script, which you can find here:
Speeding things up
However, after a while, and especially on large repos, I started noticing that this slowed down my terminal considerably. Granted that git status
is an expensive command as it is, after having a look at git-prompt.sh
— which is about 500 lines of code — I found that there was still some room to speed things up.
Of course, the exact definition of what git status information is relevant in a terminal prompt, will differ from user to user. For me, though, I found that the…