How to add git branch name to Linux bash prompt

How to add git branch name to Linux bash prompt

Sajad Kolahi

1 год назад

1,033 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@sajadkolahi
@sajadkolahi - 28.05.2023 08:38

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

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\033[0;32m$(__git_ps1 " (%s)")\033[0m\$ ' # --AND-- PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s)")\$ '

Ответить
@zhi_bft
@zhi_bft - 11.07.2023 14:30

Thank you so much! Your video help me a lot.

Ответить
@ariftraideas
@ariftraideas - 30.12.2023 11:11

thanks

Ответить