I use MAC OS 90% of the time for Development work, Trying to also be proficient at Windows Development and hone in similar settings on Windows that I use for MAC. I installed Git Bash instead of using Powershell or CMD so I could keep muscle memory workflows.
I have spent countless hours building out a custom .bashrc file instead of using ZSH (because I wanted to learn) that will give me a custom terminal prompt that I enjoy that includes username, directory and git information. This was all coded by me for learning purposes.
- Username (blue) & Directory (purple)
- Branch Name (Green if branch matches repo, Yellow if changes are found)
- Behind (↓) & Ahead (↑) Status
- Staged (+) & Unstaged (-) Status
- Untracked (?) Status
- Nerd Font Glyphs - Removes standard status icons and uses Nerd Font Glyphs instead. Need to install Nerd Font to work
- Debug Mode - Outputs branch & all status counts to terminal
- Test Mode - Shows all status icons & counts with sample values
- Simple Mode - Turns off all status icons & counts, Only showing a red X next to branch indicating not clean. Keeping branch color settings (green for clean, yellow for changes)
- Compact Mode - Turns off all status icons & counts, Shows a colored
❱at end of prompt for each status instead of the symbols. Keeping branch color settings (green for clean, yellow for changes) - Fully Configurable Options - Able to toggle each individual or all status icons or counts on/off
- Windows Terminal (https://github.com/microsoft/terminal)
- Warp for Windows (I've been loving the AI features) (https://www.warp.dev)
- Download
.git_prompt.shscript and make sure the script executable by entering the following in your terminal:
chmod +x ~/.git_prompt.sh- In your
.bashrcor.bash_profilefile make sure to source the script by:
# Source the git prompt script if it exists
if [ -f ~/.git_prompt.sh ]; then
. ~/.git_prompt.sh
fi- Append Git prompt to your
PS1by:
# Add git information if available
local git_info=$(get_git_prompt)
if [ -n "$git_info" ]; then
PS1+="$git_info"
fiSee my .bashrc for a working example of how I'm using it.
✌️ Hope you enjoy! ✌️:
- Separate Prompt Logic to be more modular
- Move Git Logic to it's own shell script
- Update .bashrc to only include basic logic
- Source any extra logic and append to PS1
- Move Staged Changes inside parentheses
- Move Untracked Changes inside parentheses
- De Clutter visually when multiple cases are true (color code better? Or better separation?)
- Configuration Section - Make all colors, symbols and individual status configurable, Will make it easy to maintain and change values
- Configuration in
.basrcto change username and directory color - Configuration in
.bashrcto toggle which standard non git options you want to show - Colors - Remove hard coded colors in
.git_promptmain code, replace with variables that are configured at top - Status Symbols - Remove hard coded status symbols in
.git_prompt, replace with variables that are configured at top - Show Status on/off Toggle - Create config at top of
.git_promptto show/hide individual status - Create a
Test Modeconfig in.git_promptthat will allow me to turn everything on for testing, all status will show even if none are true. - Create a
Debug Modein.git_promptconfig that will output the count of each status
- Configuration in
- Implement Nerd Font Icons
- Add Config to toggle these on/off OR use standard ↑ ↓ icons
- Add more Nerd Icon sets to pick from (Group 1, Group 2, Group 3)
- Expand Color Options (Had 3, now have 7)
- Replace variable names with more descriptive names (ex:
prompt_componentsvs.git_info) - Add detailed comments to explain each part/section for others
- Play around with Background Color option vs no background and colored letters
- Add a Simple Mode Setting that will turn off all status Icons & Counts, Only show a red X next to branch indicating not clean. Still keep the basic two color setting for green for clean, yellow for not clean with red X.
- Add an option with compact mode to show Colored > at end of prompt for each status.

Screenshot of COMPACT_MODE Setting that will turn off all status Icons & Counts, Shows a Colored ❱ at end of prompt for each status.

Screenshot of SIMPLE_MODE Setting that will turn off all status Icons & Counts, Only show a red X next to branch indicating not clean. Still keeping the basic two color setting for green for clean, yellow for not clean.

Screenshot of DEBUG_MODE & TEST_MODE turn on not inside a git branch, DEBUG_MODE echos out status variable values to the terminal while TEST_MODE sets up fake variable values to test all status so you don't have to recreate each scenario

Screenshot of DEBUG_MODE turned on but TEST_MODE turn off inside a working git branch, Green branch name = no changes found, yellow branch name means changes found with included status for each found

Screenshot of work done today to create and separate configuration options from implementation logic
- Removed arrow on right side of prompt to clean up prompt, didnt feel like it was needed and looks cleaner without.
- Cleaned up redundancy between the compact mode and normal mode code.
- Implemented
SIMPLE_MODESetting that will turn off all status Icons & Counts, Still keeping the basic two color branch name setting (green for clean, yellow for not clean) - Created
SIMPLE_MODEconfig option to toggle mode on/off - In
SIMPLE_MODEsince all status Icons & Counts were gone, added a Red "X" on right side of branch name when there is branch changes to visually see your not in sync.
- Implemented
SIMPLE_MODESetting that will turn off all status Icons & Counts, Still keeping the basic two color branch name setting (green for clean, yellow for not clean) - Created
SIMPLE_MODEconfig option to toggle mode on/off - In
SIMPLE_MODEsince all status Icons & Counts were gone, added a Red "X" on right side of branch name when there is branch changes to visually see your not in sync.
- Implemented Nerd Font Glyphs
- Created config to toggle Nerd Fonts Glyphs on/off vs. standard icons
Today was a big day! 🔥 Added/Changed a lot with the below progress.
- Added Configurability
- Added dedicated configuration section with clear header comments for easy modification
- Separated configuration options from implementation logic
- Added
Show Statustoggle config to turn each status on/off - Added
SHOW_COUNTStoggle to control displaying numeric values vs. symbols only - Added
DEBUG_MODEthat outputs all variables to stderr for troubleshooting - Implemented
TEST_MODEwith configurable test values for easy visual testing
- Reorganized & Improved Code Structure
- Grouped related functionality together for better code organization
- Added detailed comments explaining purpose of each section
- Improved spacing between status components for better readability
- Created consistent formatting approach using helper functions
- Added Color Options
- Expanded color definitions beyond the original green/yellow/blue
- Added distinct colors for different repository states
- Implemented consistent color application logic based on repo status
- Changed color assignments to ensure each git status has a unique color
- Improved Status Display
- Fixed issue with staged/untracked indicators appearing outside parentheses
- Removed confusing
DIVERGED_SYMBOLin favor of separate ahead/behind indicators
- Enhanced Maintainability
- Replaced generic variable names with more descriptive ones (
prompt_componentsvs.git_info) - Implemented array-based approach for cleaner string building
- Standardized error handling and redirection across git command
- Replaced generic variable names with more descriptive ones (
- Improved Performance
- Added conditional execution for expensive remote status checks
- Implemented early return for directories not under git control
- Reduced redundant command executions
- Added "On" before branch name if found
- Separated prompt logic to be more modular
- Moved Git Logic to it's own shell script called
.git_prompt - Updated
.bashrcto only include basic logic - Source
.git_promptand append to PS1 - Moved Staged Changes inside branch parentheses
- Moved Untracked changes inside branch parentheses


