How to recover a dropped stash in Git?

前端 未结 19 2268
别跟我提以往
别跟我提以往 2020-11-22 01:42

I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday I had some changes in my working tree that I

19条回答
  •  忘掉有多难
    2020-11-22 02:00

    I want to add to the accepted solution another good way to go through all the changes, when you either don't have gitk available or no X for output.

    git fsck --no-reflog | awk '/dangling commit/ {print $3}' > tmp_commits
    
    for h in `cat tmp_commits`; do git show $h | less; done
    

    Then you get all the diffs for those hashes displayed one after another. Press 'q' to get to the next diff.

提交回复
热议问题