demand

The default window will show the current file directory and Git branch name, but I would like to see more information, such as whether there are uncommitted changes, unpushed commits, etc. This gives me an idea of the status of my current project when I open the bash window each day.

search

I did some research on the Internet and decided to use bash-Git-Prompt.

The results of

Here is the final comparison:

The default window

bash-git-prompt

See bash-Git-prompt for details.

(master write 3 | ✚ 1) : on branch master, ahead of remote by 3 commits, 1 file changed but not staged (status | low 2) : On branch status, 2 files staged (master | ✚ 7...). : on branch master, 7 files changed, some files untracked (master | ✖ 2 ✚ 3) : On branch master, 2, 3, conflicts, 3 files changed (master | ⚑ 2) : on branch master, 2 stash entries (experimental left 2 write down 3 | ✔) : on branch experimental; your branch has diverged by 3 commits, remote by 2 commits; The repository is otherwise clean (: 70 c2952 | ✔) : not on any branch. parent commit hashash 70c2952; the repository is otherwise clean
Copy the code

implementation

Clone the bash-git-prompt project in Git/etc:

git clone https://github.com/magicmonty/bash-git-prompt.git
Copy the code

Then open the bash.bashrc file in Git/etc with an editor and comment all the code in it. Add the following three lines of code:

GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_THEME=Evermeet  Git\etc\. Bash-git -prompt\themes
source /etc/.bash-git-prompt/gitprompt.sh
Copy the code

After saving the file, reopen the Git Bash window and Voila! The installation is ready

The problem

If you find a problem with checkmarks and arrows in the window, you can do this: right-click the title bar of the window -> Options -> Text -> Font Select -> DejaVu Sans Mono

Reference: Strange Character

The font limitation shows up in the default Ubuntu shell on Windows 10 as well but I was able to see the glyph characters by simply using DejaVu Mono dejavu-fonts.github.io/. What @scotlynhatt means is download the font on windows, install it and then select it from the font menu for the WSL window (right click on the title bar -> properties -> font).