How to recover a dropped stash in Git?

前端 未结 19 1700
别跟我提以往
别跟我提以往 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:15

    Why do people ask this question? Because they don't yet know about or understand the reflog.

    Most answers to this question give long commands with options almost nobody will remember. So people come into this question and copy paste whatever they think they need and forget it almost immediately after.

    I would advise everyone with this question to just check the reflog (git reflog), not much more than that. Once you see that list of all commits there are a hundred ways to find out what commit you're looking for and to cherry-pick it or create a branch from it. In the process you'll have learned about the reflog and useful options to various basic git commands.

提交回复
热议问题