+55

Apply Stash: allow ability to apply selected files only

lesley_freed 2 years ago • updated by Chris Kline 1 month ago 12

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.

+1

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.

+1

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.

+1

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)?

+1

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...".

+1

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)

Great. But please implement both enhancements - working with stashes in Log is not very convenient IMHO.

+2

Thomas, while the other request you mentioned may be a "more general request", the workflow would be quite different. I think what people are asking for in this request is the ability to select a stash under the 'Stashes' section of the 'Branches' pane and choose something like an 'apply subset' option which would open a dialog in which specific files could be selected for application.


This is a quite different workflow from the other request, which would require:

  1. opening the log window and finding the stash in the log
  2. for each of the (up to) 3 sub-commits of the stash  (1 for each of untracked files, index, and workspace changes):
    • select the individual files
    • right-click and cherrypick
    • resolve conflicts