# Re: \[PATCH\] Bash snippet to show branch and patch in bash prompt

- From: Catalin Marinas \<catalin.marinas@arm.com\>
- Date: 2016-08-11 19:54:07 
- List: git
- Page: https://ratatoskr.run/git/2016/08/7689976
- Thread: https://ratatoskr.run/git/2016/08/7689976/t.md

```text
Robin Rosenberg [ref] wrote:
> From: Robin Rosenberg <redacted>
>
> Signed-off-by: Robin Rosenberg <redacted>
> ---
>
>  contrib/stgbashprompt.sh |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/contrib/stgbashprompt.sh b/contrib/stgbashprompt.sh
> new file mode 100755
> index 0000000..792da53
> --- /dev/null
> +++ b/contrib/stgbashprompt.sh
> @@ -0,0 +1,16 @@
> +# include this in your bashrc or copy to /etc/bash_completions.d
> +
> +if [ "$PS1" ]; then
> +    # trap 'PS1="\u@\h [$(stg top)] \w]\$ "' DEBUG
> +    function stgtag
> +    {
> +	br=$(stg branch 2>/dev/null)
> +	top=$(stg top 2>/dev/null)
> +	if [[ -n "$br$top" ]];then
> +	    echo "[$top@$br]"
> +	    return
> +	fi
> +    }
> +    PS1='\u@\h$(stgtag)\w\$ '
> +
> +fi

Isn't this the same patch? "stg refresh" :-)?

-- 
Catalin

P.S. could you please send them to my catalin.marinas@gmail.com
```
