pure
pure copied to clipboard
Use '+' on git prompt when all changes are staged, and '*' for unstaged changes.
It would be nice with a '+' after having added files using git add to the index, rather than just still having the '*
around. If there are both a dirty worktree and uncommitted files it should both be +*
as per the usual bash git prompt.
Non-async code is essentialy already available in git-prompt.sh: https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh#L483 (I don't know if any other functionality is missing from that as well, in which case I'd like to see that as well!)
Could you motivate what value this suggestion brings to your workflow?
My opinion is that the +
-sign would add visual noise without very much value. It's not like the +
can tell you anything actionable.
Let's say you see the +
and do a commit & push, just to realize a moment later you hadn't added file foo.bar
because you didn't check git status
beforehand. This might be a contrived example, but should illustrate my point.
If you make some changes, add them, and then keep making some minor changes before committing the *+
will immediately tell you that you have more changes that you can add - without having to do an extra git status. I use this quite a lot, to the point that just seeing the *
now usually means that I have missed something when I am typing git commit
.
Even if you stage your changes, Pure shows *
until you've committed, so showing *+
would not tell you that you have new unstaged changes.
What do you mean? That is my suggestion; that it should show a *
only if there are unstaged changes - as per the behavior of the official git-bash prompt. (please excuse the confusing title..)
Ah, I understand what you mean now. I've never used that git prompt so I'm not familiar with how it behaves.
However, making this change would break current Pure behavior, so it can't be made lightly. I'll try to experiment with this a bit in the near future and try to figure out whether or not it's a good fit for Pure.
Ok, thanks, I've found this feature to be very useful! There are also symbols for stashed changes etc..
Git stash has been discussed previously in #317 and #365. Let's keep that as a separate discussion. We want Pure to stay pure, and that involves keeping visual noise to a minimum, so each feature must be weighed against that.
I would like to see distinction between staged/unstaged/untracked files. All the three is just shown as '*' now. May be just a color change for '*' is good enough.
Powerlevel10k has support for untracked files, and it looks like this:
~/repo master
❯ touch file
~/repo master?
❯ git add .
~/repo master+
❯
~/repo master+
❯ touch file2
~/repo master+?
❯
When files are untracked, it shows ?
. When they're staged it shows +
. It shows both when there're untracked and staged.
It would be nice to have the same feature in Pure.