elementary / elementary/default-settings

Show branch if in a git directory by default.

Open
#348 3 comments 10 reactions 0 assignees View on GitHub
Needs Design
Dominant language
Meson
Stars
38
Forks
28
Avg merge
1h 50m
Merged PRs (30d)
1

Description

Please consider to add this to `.bashrc` by default.

~~~bash
# Add git branch if its present to PS1

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.