How to go back to previous commit without losing last commit in Git?

后端 未结 3 1134
长情又很酷
长情又很酷 2021-02-07 08:01

Here is what I want to do. I want to go back to 2 commits before, bring back the files that changed in that commit as a new commit maybe. But I do not want to lose my last commi

3条回答
  •  清歌不尽
    2021-02-07 08:41

    With $ git reflog you can see the last hashes which are useful to return to a previous state after having lost the last commits by forcing a push from a previous commit.

    Also:

    $ git fsck --no-reflog
    $ git show 
    $ git checkout -b  
    

    GL

    Source

提交回复
热议问题