GitHub Desktop may overwrite existing stash when "Always stash and leave my changes" is selected #10956
Labels
bug
Confirmed bugs or reports that are very likely to be bugs
priority-1
Bug that affects many users in a significant way and prevents core functions
Describe the bug
When checking out a branch using the pull request list or by following a "Checkout in Desktop" link on GitHub.com while having the "Always stash and leave my changes on the current branch" option selected in preferences (under Advanced) GitHub Desktop fails to prompt the user for confirmation before overwriting their existing stash.
Version & OS
I believe this has been true since #8813 which shipped in 2.3.0. OS-independent
Steps to reproduce the behavior
Expected behavior
GitHub Desktop should show a confirmation prompt like the one below
Actual behavior
The PR branch is checked out and the stash on the previous branch is overwritten with a newly created stash containing your uncommitted changes.
Additional context
I've got a fix ready for this, I just wanted to ensure we have a record of this being a bug that we can refer back to. The dropped stash can be restored by looking through the GitHub Desktop logs and searching for a message with the following format:
Taking that stash SHA one could restore the changes by running
git stash apply 0e95c933c4c6ba4403564407f2c8a7fbe829fb3d
The text was updated successfully, but these errors were encountered: