fork-dev / TrackerWin

Bug and issue tracker for Fork for Windows
459 stars 10 forks source link

Allow stashing unstaged changes only #444

Open michael-hawker opened 4 years ago

michael-hawker commented 4 years ago

Sometimes I only want to stash part of my set of files. It'd be great to be able to stash a set of files, or just the unstaged ones or something. I've seen other git clients like SourceTree do this as well.

DanPristupov commented 4 years ago

I've seen other git clients like SourceTree do this as well.

I'm not familiar with it. Can you provide more details or show a screenshot at least?

michael-hawker commented 4 years ago

The feature Source Tree has is documented here.

Their stash dialog has a checkbox that lets you keep the staged files in the workspace:

I do really like Fork's Stage New Files option as well, but it'd be great to get the alternate mode to stash and keep staged files. It's super helpful for squirreling away some working parts of an environment.

DanPristupov commented 4 years ago

OK, it's the --keep-index option.

Not sure if we should introduce it. New (untracked) unstaged files will not be stashed. As for me, this can lead to a quite confusing result: staged changes remain staged, some unstaged files are stashed, another part of unstaged files are still there.

michael-hawker commented 4 years ago

@DanPristupov yeah, but you're not always adding new files all the time. I think it in Fork, if they're two radio options that you can't both choose at once, then it'd mitigate that confusion. You can do one or the other, but not both.

STeeL835 commented 4 years ago

What about stashing staged files? I'm probably doing something wrong, but I often find myself using git stash save -p command from console in need to exclude some changes to test code without them.

DanPristupov commented 4 years ago

What about stashing staged files?

The original is about stashing staged changes, which is different.

git stash save -p

This shows all changes, both staged and unstaged. Not sure how it can help us.

carun commented 4 years ago

As for me, this can lead to a quite confusing result: staged changes remain staged, some unstaged files are stashed, another part of unstaged files are still there.

@DanPristupov I agree with this to some extent. But lack of such an option makes stash not quite useful. Is it possible to bring an option to stash the indexed changes only (inverse of --keep-index)? This will make it seamless to move around the indexed changes between branches.

albertodeago commented 4 years ago

@DanPristupov what about implementing somehow the git stash -p interactive functionality? it let you choose what to stash and what not. It's great imho. It's one of the few command I find myself to use outside of fork

Srekel commented 2 months ago

I want this feature quite often. I make some changes that I want to keep (but perhaps not commit yet), some changes that I want to stash for later (maybe to delete, but I want to keep them for a bit).

I would like:

  1. Select the files in unstashed you want to stash
  2. Stash selected files
  3. Those files should get stashed with the diff shown in the unstashed mode. Their staged changes should stay staged.
carun commented 2 months ago

Fork 1.98.0.0 allows us to select all the files in the Unstaged area and stash only them without impacting the Staged area. Isn't that enough?

  1. Select any file in the Unstaged area and press Ctrl-A.
  2. Right click and click on Stash X files image
  3. Final result image
Srekel commented 2 months ago

No, I would like for only the unstaged changes to be stashed. I try to do this on occasion forgetting that's not the way it works and then I have to unstash and re-stage the changes I wanted.

image
carun commented 2 months ago

@Srekel Ah, I think that message is incorrect. If you follow the steps mentioned above, it will stage only unstaged changes.