This is a detailed tutorial on how to customize and show the git branch name on your bash terminal in Ubuntu, Linux or MacOS.
Watch in HD for better clarity
Get the git-prompt.sh from here: [ Ссылка ]
Tutorial on customizing and colorizing bash-prompt: [ Ссылка ]
Click on subscribe button to subscribe to the channel.
The final command generated is as follows:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;33m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '
Be sure to source the git-prompt.sh file.
But I encourage you to experiment it by yourself
The command I personally use is this:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;34m\]\w\[\033[01;33m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '
It rids of the user and hostname which I obviously know and need not print all the time.
Please subscribe.
Ещё видео!