23 lines
1.1 KiB
Markdown
23 lines
1.1 KiB
Markdown
1. Записать [git-prompt.sh](https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh) в файл `~/.git-prompt.sh`
|
|
2. Записать [git-completion.bash](https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash) в файл `~/.git-completion.bash`
|
|
3. Вставить следующее в `~/.bashrc`:
|
|
|
|
```
|
|
if [ -f ~/.git-prompt.sh ]; then
|
|
source ~/.git-prompt.sh
|
|
fi
|
|
if [ -f ~/.git-completion.bash ]; then
|
|
source ~/.git-completion.bash
|
|
fi
|
|
|
|
if [ "$color_prompt" = yes ]; then
|
|
GIT_PS1_SHOWDIRTYSTATE=1
|
|
GIT_PS1_SHOWUNTRACKEDFILES=1
|
|
PS1='\\n\\e[1m\\033[44m \\u \\033[0m\\e[100m\\e[34m▶\\e[39m \\w\\e[92m$(__git_ps1)\\e[39m \\033[0m$(exit_status=$? ; if test $exit_status -ne 0 ; then echo -e " \\e[41m\\e[97m$exit_status\\e[0m" ; fi)\\e[0m \\e[1m\\$\\e[0m '
|
|
# строка по умолчанию:
|
|
# PS1='\\n${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '
|
|
else
|
|
PS1='\\n${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ '
|
|
fi
|
|
```
|