Add Git Prompt to WSL Terminal
Suppose you have set up WSL on your computer and installed Git. After cloning your code, you might find your terminal's appearance unhelpful because it doesn't show which branch you're currently on. Here's how my terminal looked before fixing it.
Fixing it
Before diving into the details, note that I used Bash for my WSL, so these steps will only work for those using Bash in their WSL.
Step 1: Install git-prompt.sh
curl -o ~/.git-prompt.sh https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
Step 2: Tell your .bashrc to execute following script
vim ~/.bashrc
source ~/.git-prompt.sh
PS1='\[\e[32m\]\u@\h \[\e[35m\]\w\[\e[33m\]$(__git_ps1 " (%s)")\[\e[0m\] \$ '
Step 3: Reload your .bashrc
source ~/.bashrc
And that's it! Here's what my terminal looks like now.