Use:
git reset --mixed
instead of git reset --hard
. You will not lose any changes.
This worked for me:
Do
$ git status
And check if you have Unmerged paths
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add <file>..." to mark resolution)
#
# both modified: app/assets/images/logo.png
# both modified: app/models/laundry.rb
Fix them with git add
to each of them and try git stash
again.
git add app/assets/images/logo.png
To follow up on malat's response, you can avoid losing changes by creating a patch and reapply it at a later time.
git diff --no-prefix > patch.txt
patch -p0 < patch.txt
Store your patch outside the repository folder for safety.
I used:
git reset --hard
I lost some changes, but this is ok.
maybe there are some unmerged paths in your git repository that you have to resolve before stashing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With