Skip to main content
100%

gitbranch prompt

✓ Published0🌍 Public
Aabernier
Last edited Jan 13, 2017
Created on Jan 13, 2017

This example enhances the bash prompt by visually integrating the current Git branch name. It displays the branch in green text within parentheses, immediately after the working directory, while the rest of the prompt remains the standard user, host, and directory format. The implementation uses a shell function, `parse_git_branch`, which runs `git branch` and filters its output with `sed`. The resulting function is embedded into the `PS1` environment variable via a script appended to the user’s `~/.bash_profile`.

AI-generated description

Prepend the current git branch to your bash prompt

gitbranchclone_ _bash_ _145x23

INSTALL

curl -s https://cdn.rawgit.com/abernier/c09c10d8c94114f5312a96b9c2896c69/raw/install.sh | sh
source ~/.bash_profile

Similar vizzes