diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..46c9107 --- /dev/null +++ b/.bashrc @@ -0,0 +1,11 @@ +# Function to parse and display the current Git branch +parse_git_branch() { + # Check if inside a Git repository, suppress errors (2>/dev/null) + # Get branch list, filter for the line starting with '*', and remove the first two characters '* ' + git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' +} + +# Define your custom PS1 +# The format is: [Green]user@host [Blue]pwd[Yellow] (git-branch)[Default]$ +export PS1="\\[\\033[01;32m\\]\\u@\\h\\[\\033[0m\\]:\\[\\033[01;34m\\]\\w\\[\\033[0;33m\\]\$(parse_git_branch)\\[\\033[0m\\]\\$ " +