Install developer tools on Windows Subsystem for Linux

From JMK Wiki
Revision as of 15:58, 3 June 2018 by Gabor Hudiczius (talk | contribs) (initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Install git and maven

Install git and maven:

root@localhost ~ # apt install git maven

Verify git and mvn version:

user@localhost ~ $ git --version
user@localhost ~ $ mvn -v

Include the git branch name in the PS1 prompt

Note: based on https://gist.github.com/kevinchappell/09ca3805a9531b818579.

Create and edit the /usr/local/bin/git_imports.sh file:

root@localhost ~ # nano -w /usr/local/bin/git_imports.sh
#!/bin/bash

parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

Edit the ~/.bashrc file of the user and add the following lines:

source /usr/local/bin/git_imports.sh
export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[01;33m\]\$(parse_git_branch) \[\033[01;34m\]\$\[\033[00m\] "

Reload the ~/.bashrc file

user@localhost ~ $ source ~/.bashrc

For more git prompt manipulation see https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh and https://github.com/magicmonty/bash-git-prompt.