git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bash prompt evaporates in subdirectories

From
avih <avihpit@yahoo.com>
Date
Oct 24, 2024, 12:35 UTC
Message-ID
<936191304.3152890.1729773328893@mail.yahoo.com>
In-Reply-To
<1101848017.3146876.1729770380522@mail.yahoo.com>
 On Thursday, October 24, 2024 at 02:46:21 PM GMT+3, avih <avihpit@yahoo.com> wrote:
Show 17 quoted lines
> ...
>
> I tried the following:
>
> ...
>
> 2. In a terminal (default shell is bash 5.2.37(1)):
>    sudo zypper install git  # 2.47.0-1.1
>    sudo zypper install bash-git-prompt
>
> 3. The above does NOT install git-prompt.sh which is maintained
>    together with git at the contrib dir. In its README.md:
>    ...
>
> 4.  Download git-prompt.sh from the git contrib dir:
>       curl -o ~/git-prompt.sh https://raw.githubusercontent.com/git/git/refs/tags/v2.47.0/contrib/completion/git-prompt.sh
>       chmod +x ~/git-prompt.sh
> 5. Add the following lines at the end of ~/.bashrc :
>      . ~/git-prompt.sh
>      PS1='\w$(__git_ps1)\n\$ '

Actually, "sudo zypper install git" does install the correct script at /usr/share/bash-completion/completions/git-prompt.sh

Additionally, that "git" package adds /etc/bash-completion.d/git-prompt which does source this script automatically on shell startup, therefore step 4 (the curl thing) is not required, and git-prompt.sh is already loaded automatically, and so only one line instead of two should be added to ~/.bashrc (as a minimal example):

  PS1='\w$(__git_ps1)\n\$ '
The rest is the same. Still can't reproduce it with this script.
avih
Previous: avihNext: Matěj Cepl
Message 5 of 10 in “bash prompt evaporates in subdirectories”
  1. Matěj CeplOct 22, 2024
  2. Taylor BlauOct 22, 2024
  3. Matěj CeplOct 24, 2024
  4. avihOct 24, 2024
  5. avihOct 24, 2024
  6. Matěj CeplOct 24, 2024
  7. RESOLVED [Was: Re: bash prompt evaporates in subdirectories]Matěj Cepl, Oct 24, 2024
  8. Taylor BlauOct 24, 2024
  9. avihOct 24, 2024
  10. avihOct 24, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.