Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6963027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:44:09+00:00 2026-05-27T15:44:09+00:00

I have the following in my .bashrc file: # Git Bash Completion source $HOME/.git_completion

  • 0

I have the following in my .bashrc file:

# Git Bash Completion
source "$HOME/.git_completion"
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1

# Prompt
export PS1="\e[0;35m\u@\h\e[m \e[0;34m\w$(__git_ps1):\e[m\r\n"

This should be displaying the git branch at the end of my prompt… but it’s not. If I manually source my .bash_profile, it works (my .bash_profile loads .bashrc). If I quit terminal and startup again, the git branch disappears :(.

What is causing this, and how to I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:44:10+00:00Added an answer on May 27, 2026 at 3:44 pm

    I don’t use git, but I bet the $(__git_ps1) portion of the prompt is being evaluated when PS1 is first set (and doesn’t return anything). You need to use single quotes, i.e. PS1='\e....\r\n', then the cmd-substitution will be executed each time the prompt is displayed.

    Double quotes allow env-vars and other shell features beginning with ‘$’ to be expanded. Single-quotes prevent expansions. That is the purpose of having the two types of quoting.

    See tldp.org/LDP/abs/html/quoting.html

    (I’ve deleted my comments)

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So currently I have included the following in my .bashrc file. export RUBYLIB=/home/git/project/app/helpers I
I have a .bashrc file with the following commands: PS1=... export LC_ALL=... What are
In my /etc/bash.bashrc file, I have following: export SYNCTOOL=/root/Desktop/gb alias synctest='python $SYNCTOOL/App.py' In App.py:
I have the following in a file which is sourced both by .bashrc and
I have following text in a file 23456789 When I tried to replace the
I have a script written in a file. #!/bin/bash if [ -f /bin/uname ];
I have following batch file code: @echo off SET INSTALL_PATH=c:\program files\ :ask_again if exist
I have following link in a.aspx file: <a href=a.htm target=iframe>A</a> I want to set
I have following mysqli configuration settings on a separate file: $mysqli = new mysqli(localhost,
i have the following alias set in my .bashrc: alias la='ls -laG' but i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.