This is the method I use to display the git branch I am currently working on.
I check for the existence of a .git folder, then I run the command git bash.
I also check to see in the virtual environment is enabled.
# Display the current branch.
function git_branch() {
if [ -d .git ] ; then
printf "%s" "($(git branch | awk '/\*/{print $2}'))";
fi
}
# Check if the virtual environment is enabled.
function is_venv_enabled() {
[ -z "$VIRTUAL_ENV" ] || printf "%s" "(venv)"
}
# Set the prompt.
function bash_prompt(){
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]$(git_branch)$(is_venv_enabled)\W \$ \[\033[00m\]'
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is the method I use to display the git branch I am currently working on.
I check for the existence of a .git folder, then I run the command git bash.
I also check to see in the virtual environment is enabled.