Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git stash support #317

Closed
leoj3n opened this issue Apr 20, 2017 · 11 comments
Closed

Git stash support #317

leoj3n opened this issue Apr 20, 2017 · 11 comments

Comments

@leoj3n
Copy link
Contributor

leoj3n commented Apr 20, 2017

Would be cool if the prompt showed an indicator when the current repo has stashes.

@mafredri
Copy link
Collaborator

How would you display it?

I'm not a big fan of the suggestion. I usually have something in my git stash and would be annoyed by the constant reminder as I don't use it for storing important stuff, it's a temporary workspace.

Just for pure I have 38 stashes, first one from Mon Feb 23 15:33:22 2015 😝.

@leoj3n
Copy link
Contributor Author

leoj3n commented Apr 20, 2017 via email

@leoj3n
Copy link
Contributor Author

leoj3n commented Apr 20, 2017

@mafredri
Copy link
Collaborator

Maybe it would remind you to take care of clearing

For me it would be more of a nag to get rid of my stash, which I don't want. Most of it is junk, but I keep some things in there for a reason. E.g. dead-ends I might to re-visit or otherwise keep handy in case I need it in the future.

@mafredri mafredri changed the title git stash Git stash Apr 24, 2017
@mafredri mafredri changed the title Git stash Git stash support Apr 24, 2017
@sindresorhus
Copy link
Owner

I'm also 👎

@leoj3n
Copy link
Contributor Author

leoj3n commented Apr 24, 2017

dead-ends I might to re-visit

Wouldn't that make more sense as a local branch?

@mafredri
Copy link
Collaborator

mafredri commented Jul 5, 2017

Wouldn't that make more sense as a local branch?

Some things aren't worth the effort to turn into a branch. Either way, stash is part of my workflow and I have no plans on changing how I use it 🙂.

I'm sorry if this inconveniences you @leoj3n, but I don't think we're going to implement this. This issue has now been open for 2.5 months without any up-votes. There is also no benefit to keeping a clean stash, so I see reminding people as a negative. I've already voiced my other concerns so I wont repeat those.

@mafredri mafredri closed this as completed Jul 5, 2017
@leoj3n
Copy link
Contributor Author

leoj3n commented Jul 6, 2017

I guess it would annoy some people, but it would remind me not to blow away important changes! 😅

I'm sorry if this inconveniences you

No worries, not having a git stash prompt indicator won't inconvenience me that much (in turn, I'm sorry if this feature suggestion inconvenienced you!). Thanks for your consideration regardless.

There is also no benefit to keeping a clean stash

I didn't make this issue to argue that there were any benefits to "keeping a clean stash"; I just thought that was something you were struggling with, based on what you posted @mafredri ...

The primary impetus, and reason I made the issue originally, is because I accidentally blew away a local repo's directory that had changes in stash that I had forgotten about. The repo was up to date with master, it had no new branches, and git status reported no changes, which was all in agreement with the pure prompt symbols. As a light/rare user of git stash, I didn't think to check the stash before permanently deleting the repo directory from my local system.

Now, it is of course my duty as a good developer to always remember to check the stash before blowing away a directory, and this mistake caused me enough pain that I will hopefully remember to check in the future, but I still think the suggestion would have saved me here. Programmers can be lazy, and sometimes do use git stash on important uncommitted changes; to protect us from our laziness, a stash indicator would help.

stash is part of my workflow and I have no plans on changing how I use it

Again, just to reiterate, I didn't make this issue to change how you use git stash or suggest a prompt indicator that would annoy you; I made this issue in a bid to protect myself and other less prolific users of git stash from forgetting that we had stashed something important!


Although I thought this would be a pretty useful improvement, the absence of a prompt indicator for git stash won't be a huge inconvenience, because I can still think of other measures to remind you of a forgotten stash, such as aliasing git status so that it will notify of any possible stashes.

I think aliasing git status will suffice, until/unless there's some way to add a custom indicator to the pure prompt without maintaining a fork (I see a related issue open about this).

@leoj3n
Copy link
Contributor Author

leoj3n commented Jul 6, 2017

@mafredri Sorry if the original issue wasn't clear about wanting the indicator to prevent forgetting a repo has stashes. As someone who rarely uses git stash, that purpose was obvious to me, and at the time I thought it was obvious to you as well, but in retrospect I probably should have elaborated.

@mafredri
Copy link
Collaborator

mafredri commented Jul 6, 2017

Thanks for the writeup @leoj3n and sorry about your bad experience, it can be painful when work done is lost (at least pain teaches us a lot). Your last two comments did help put this feature request in a different perspective, so thanks for that.

Also, don't worry, this hasn't inconvenienced me in any way, I would encourage our users to come up with ideas/ways to make Pure even more awesome. It's unfortunate that this feature request doesn't quite align with our vision for Pure. It's a fine balance between adding useful features and create a (visually) noisy prompt. We also want to keep options to a minimum, any feature that requires an option needs to be evaluated with extra care.

One option you have is to utilize the right prompt, e.g. RPROMPT='$(git stash list|wc -l)' as a quick example. It's async by nature so you don't need to worry about it slowing down your prompt 🙂 .

I think aliasing git status will suffice, until/unless there's some way to add a custom indicator to the pure prompt without maintaining a fork (I see a related issue open about this).

This is something I'm actively thinking about (e.g. allowing power users to hook in and make modifications). That said, I'm not dedicating many braincells to it, just constantly keeping it in the back of my head. I've yet to come up with a solution I'm satisfied with.


PS. If you use macOS and Time Machine backups there's a chance you could recover your deleted repository from the past, just thought I'd mention 🙂 .

@fauust
Copy link
Contributor

fauust commented Sep 10, 2019

I strongly agree with pure staying pure and every new feature being (very) carefully discussed before implemented/accepted.

But in my workflow, I am more comfortable if I know when my local modifications are not backuped.

So this is my horrible quick and dirty improvement of @mafredri RPROMPT suggestion :

RPROMPT='$(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \
  s=$(git stash list|wc -l); \
  if (( s != 0 )); then \
    echo "(stash: $s)"; \
    fi; \
  fi)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants