Let's say I perform the following commands to create a merge conflict with a git stash pop:
echo "1" > one;
echo "2" > two;
git add -A;
git commit -m "first";
echo "1.1" > one;
echo "2.1" > two;
git stash;
echo "2.2" > two;
git commit -a -m "second";
echo "3" > three;
git add -A;
echo "4" > four;
git stash pop;
git status
which gives me:
On branch develop
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: one
new file: three
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: two
Untracked files:
(use "git add <file>..." to include in what will be committed)
four
In this case, files three and four are unrelated to the stash pop and have work-in-progress. If I have a lot of files in progress, it's difficult to go through and try to figure out what was or was not affected by the stash, and individually reset files or resolve conflicts.
I've searched all over SO but I cannot find a good way to just remove the effects of the stash pop. I can't just do git reset HEAD . to unstage the files. I've tried to create a patch from the stash and reverse apply it but it doesn't work because file two looks like this:
<<<<<<< Updated upstream
2.2
=======
2.1
>>>>>>> Stashed changes
With this file there should be a way to just keep the upstream changes and remove the stashed changes?
Do I have to suck it up and resolve the merge conflicts or is there a way to separate what was in my working directory before the stash pop?