magicmonty / magicmonty/bash-git-prompt

overwrites existing $PROMPT_COMMAND

Open Beginner friendly
#574 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
6.9k
Forks
983
Avg merge
13d 22h
Merged PRs (30d)
2

Description

Sourcing gitprompt.sh replaces prompt command, not appends to it; following in ~/.bashrc:

$ echo "pre prompt: [$PROMPT_COMMAND]"
$ source "/installation/path/bash-git-prompt/gitprompt.sh"
$ echo "post prompt: [$PROMPT_COMMAND]"

...produces this:

pre prompt: [history -a]
post prompt: [setLastCommandState]

I would expect existing value to survive the import.

Running v 0bca406


Could this be the cause for issues like https://github.com/magicmonty/bash-git-prompt/issues/496?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with gitprompt.sh and reproduce the issue from ~/.bashrc using the echo-and-source commands in the report. Trace where PROMPT_COMMAND is assigned, then verify that an existing value such as history -a survives sourcing while the Git prompt still runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.