0

I have two stashes that overlap. I think that if I apply both stashes, I will have a mess, because I don't need some changes in one of the stashes. So I would like to apply one stash and then apply only changes to specific files from another stash, even better if interactively. How can I do it?

My question is different than this one suggested, because the OP of that question wants apply stash to different commits, I want to apply two stashes to my code.

Community
  • 1
  • 1
rightaway717
  • 2,065
  • 21
  • 36
  • 2
    Possible duplicate of [How can I apply only some of a git stash?](http://stackoverflow.com/questions/15212882/how-can-i-apply-only-some-of-a-git-stash) – Francesco Apr 20 '16 at 13:53
  • Possible duplicate of [Git: how to use stash -p to stash specific files?](https://stackoverflow.com/questions/23704241/git-how-to-use-stash-p-to-stash-specific-files) – Nemo May 16 '18 at 20:53

1 Answers1

2

Apply one stash, reset the files you don't want, commit the others, apply the second stash, reset the files from the first, commit.

bnord
  • 375
  • 1
  • 12
  • The problem is that I have changes in both stashes to some same files, and I want them both, but they are conflicting. I don't mean that I want changes to only specific files from specific stash – rightaway717 Apr 20 '16 at 14:02
  • Apply the first, commit, apply the second (you will need to specify the stash), you will get a merge conflict if there are conflicting edits just like when merging, clean up the conflicts, commit. – bnord Apr 20 '16 at 14:12