twolfson / sexy-bash-prompt

Bash prompt with colors, git statuses, and git branches.
MIT License
1.14k stars 155 forks source link

Git stash status #33

Closed yan-foto closed 10 years ago

yan-foto commented 10 years ago

Is it possible to also show if files are on the stash or not?

twolfson commented 10 years ago

I understand the reason for this request but I am not sure everyone uses stash in the same fashion. For example, I usually have a stash accumulated with temporary adjustments for easier debugging.

yan-foto commented 10 years ago

Totally understandable. Maybe in some near future you could add a feature and make it optional.

twolfson commented 10 years ago

For future reference, what was the idea you had for visualizing there being a stash? Another keyword as if you are in merge? (e.g. master [stash])

yan-foto commented 10 years ago

I used to use another script to show my git status before I switched to the more "sexy" alternative. They simply used $ to indicate a non-empty stash. Pretty clean and space sparing.

twolfson commented 10 years ago

Can you provide a link?

yan-foto commented 10 years ago

It is included in Drupal QuickStart. See below:

export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export PS1=$IBlack$Time12h$Color_Off'$(git branch &>/dev/null;\
if [ $? -eq 0 ]; then \
  echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
  if [ "$?" -eq "0" ]; then \
    #Clean repository - nothing to commit
    echo "'$Green'"$(__git_ps1 " (%s)"); \
  else \
    # changes to working tree
    echo "'$IRed'"$(__git_ps1 " {%s}"); \
  fi) '$BYellow$PathShort$Color_Off'\$ "; \
else \
  echo " '$Yellow$PathShort$Color_Off'\$ "; \
fi)'
twolfson commented 10 years ago

Cool, thanks =)

yan-foto commented 10 years ago

At your service :)