Is there a way to change/replace the default Ubuntu terminal with Git-bash(look and behavior) of Window? Basically, the terminal should display all the necessary information related with current branch/repo, just like it does in Window.
I am using VS Code and had configured Git-Bash with it for Window platform. But couldn't find anything which would let me achieve the same on Ubuntu platform.
I have checked following links for answers -
After @kostix suggestion, I searched the internet with proper key-words and found this question thread and then finally to this page. After trying approaches mentioned there, I ended up with the following code which works much better. Add these code in the .bashrc
file present in Home
folder. Find it using ~/.bashrc/
command.
# git branch info if present
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[36m\]\u@\h\[\033[00m\] \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \n\[\033[1;31m\]>>\[\033[00m\] "
Ubuntu's terminal screenshot -
VS code's terminal screenshot -
You can update the code to alter color code(s) depending on your choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With