Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Star * symbol in git prompt on zsh

Tags:

git

oh-my-zsh

Terminal: iTerm2

Shell: zsh (oh my zsh)

Issue: I am seeing a star * on git prompt even though the branch has been updated and no changes have been made. Any idea what it means and how to get it cleared from the git prompt.

See Image

like image 652
Krush Avatar asked Sep 13 '25 17:09

Krush


2 Answers

The * indicates that you have x number of stashes saved on this repository. So in your case *1 means that you have 1 stash stored on this repository. Run below command and you will see that this number matches the number of stashes:

git stash list

If *1 bothers you then you can remove† your stashes with:

git stash clear

†: this will permanently delete your stashes and you will not be able to recover them through the normal safety mechanisms‡.

‡: Reference - https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-Recoveringstashentriesthatwerecleareddroppederroneously

like image 66
Anthony Avila Avatar answered Sep 15 '25 09:09

Anthony Avila


The official git-prompt.sh script includes:

# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
# unstaged (*) and staged (+) changes will be shown next to the branch
# name.  You can configure this per-repository with the
# bash.showDirtyState variable, which defaults to true once
# GIT_PS1_SHOWDIRTYSTATE is enabled.

Check first in your ~/.zshrc if you are using vcs_info instead.
It could come with its own set of customization, as in this gist.

For instance, check with git stash list if you have any files stashed.

like image 36
VonC Avatar answered Sep 15 '25 10:09

VonC