Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

ubuntu show git branch in terminal

# Show git branch name
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/(1)/'
}
if [ "$color_prompt" = yes ]; then
 PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[01;31m]$(parse_git_branch)[33[00m]$ '
else
 PS1='${debian_chroot:+($debian_chroot)}u@h:w$(parse_git_branch)$ '
fi
unset color_prompt force_color_prompt
Comment

show git branch on terminal

# Show git branch name
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/(1)/'
}
if [ "$color_prompt" = yes ]; then
 PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[01;31m]$(parse_git_branch)[33[00m]$ '
else
 PS1='${debian_chroot:+($debian_chroot)}u@h:w$(parse_git_branch)$ '
fi
unset color_prompt force_color_prompt
Comment

PREVIOUS NEXT
Code Example
Shell :: Error: .ini file does not include supervisorctl section 
Shell :: ssh-keygen and ssh-copy-id 
Shell :: npm ignore scripts 
Shell :: installing rspec gemfile 
Shell :: grep multiple strings 
Shell :: generate key and certificate openssl 
Shell :: ubuntu mouse mover 
Shell :: rollback git 
Shell :: install heroku 
Shell :: get string after character shell script 
Shell :: BUILD FAILED (Ubuntu 20.04 using python-build 20180424) 
Shell :: check internet speed on mac terminal 
Shell :: how to install apple music ubuntu 
Shell :: docker.service: Unit entered failed state. 
Shell :: linux remove last line from file 
Shell :: eslint install command 
Shell :: gitignore global example 
Shell :: matlab on ubuntu 
Shell :: linux history with time 
Shell :: kill all mongodb processes 
Shell :: how to check if a python script is running 
Shell :: replace substring in shell 
Shell :: how to install python on linux/terminal 
Shell :: rancher install docker 
Shell :: how to install ssh in windows 10 
Shell :: find folder in linux 
Shell :: npm install from github branch 
Shell :: node latest version ubuntu 
Shell :: how to install multiple packages in one line of pip 
Shell :: wp cache 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =