Apply Stash: allow ability to apply selected files only

lesley_freed 1 year ago • updated by Thomas Singer 4 months ago 10

Applying a stash may fail due to conflicts. It would be helpful to be able to view what is in a stash and selectively apply a subset of the files.


Regarding the "see what is inside a stash" part: you can see it in the log.

Seems like a valuable solution, combined with the "compare with local" option ! Thanks for the tip

Good idea, also offer to do this in popup when stash apply fails (skip conflicts).

Even better would be ability to apply stash and mark the files and conflicted just like when pulling. Although I don't know how that could be implemented.


This would be very helpful to us as well. I was about to file this request myself when I saw that someone else already had.

What I would like would be the ability to right-click on a stash in the stashes list and choose "Selectively Apply Stash...". This would then open a dialog where I can select the subset of files I wish to unstash. The reason I would like a separate dialog is that, currently, the log breaks stashes apart into 3 separate commits (index, untracked, and local changes), and it's not currently possible to simultaneously select files from multiple of these.

Ideally, as Petr D. suggested above, this would result in resolvable conflicts if they occur.

The current work-around, of course, is to apply a full stash (maybe with conflicts) and discard all unnecessary changes. Maybe this also gets obsolete when getting used to stashing selected files.


It's a workaround, but clumsy for a very common use case:

  • I'm working on a task, but have to switch to something else, so I stash all the files so I can come back to it later.
  • Some time later (perhaps weeks), I'm working on a different task, and I want to apply some -- but not all -- changes from the previous stash. A common example would be taking a single settings file from a previous multi-file stash.
  • Currently I must first either A) stash all my current work away, apply the old stash, delete the files I don't want, then reapply the other stash, or B) apply the stash on top of my current work, hope that there are no conflicting files preventing me from unstashing, resolve any unwanted conflicts, and delete the unwanted files.

It's especially painful in our ~250,000 file repo in which individual stash/unstash and full refresh operations can take 20-30 seconds or more.

It would be much nicer if I could just select the individual files I wanted from the old stash and apply them in one operation.

Where you would expect to see this feature - in the Log (having stash files selected) or should the Apply Stash command should list all files for the index, working copy and untracked files)?


I would be happy to see the option to apply selected files appear under the same tab that the three "stash" operations appear now:  Local.  Perhaps an "apply selected files from stash...".


I too would like to see it as an option when you right-click on a stash. I.e. you do "apply subset of files from stash" and then it opens up a dialog allowing you to select which files you want (with an additional option to "select all" or "select none", as a starting point for adding/removing specific files)