irongit

Hygo AI custom shell.

shows the git branch

huncholanehuncholaneauthored
parent 8a5d02ecommit 29f2a43c18fe9cb07e585e66933790707ea1dc05Browse files

1 file changed, +12 -1

+12-1setup.sh
@@ -8,9 +8,20 @@ else
88 fi
99 cd $CURRENT_DIR
1010
11+# Function to get the current Git branch
12+git_branch_str() {
13+ git_branch=$(git branch 2>/dev/null | grep '*' | sed 's/* //')
14+ if [ -n "$git_branch" ]; then
15+ echo -e "($git_branch)"
16+ fi
17+}
18+
19+# Set up zsh prompt
1120 if [ -n "$ZSH_VERSION" ]; then
1221 PROMPT="%F{214}%n@%m %F{white}%~"$'\n'"%f$ "
1322 fi
23+
24+# Set up bash prompt
1425 if [ -n "$BASH_VERSION" ]; then
15- PS1="\[\e[38;5;214m\]\u@\h \w\n\$\[\e[0m\] "
26+ PS1="\[\e[38;5;214m\]\u@\h \w $(git_branch_str)\n\$\[\e[0m\] "
1627 fi