nqzero> git stash save -p nqzero> git stash pop error: Your local changes to the following files would be overwritten by merge: nutrweb/web/js/diary.js Please, commit your changes or stash them before you can merge. Aborting nqzero> git add -u nqzero> git stash pop # hard to recover if there are conflictsif there aren't any conflicts this is the bee's knees. but if there are conflicts, there's no obvious way to undo the merge (ie un-pop the stash) - the index has been corrupted. any suggestions ? without this, git stash save --patch considered harmful, ie it's very easy to lose changes
WORKAROUNDgit stash create a backup before popping the stash. maybe git should do this for any merge with a dirty tree
nqzero> tmp=$(git stash create) nqzero> git stash pop Auto-merging nutrweb/web/js/diary.js CONFLICT (content): Merge conflict in nutrweb/web/js/diary.js nqzero> git reset --hard nqzero> git checkout $tmp -- .