git reset --soft and going back to the latest commit

前端 未结 2 1294
北海茫月
北海茫月 2021-02-01 22:38

So I just did a git --reset soft to go back to a previous commit. Now what if I want to go back to the latest commit that I was at before? i.e: the latest commit? I tried doing

2条回答
  •  遥遥无期
    2021-02-01 22:54

    Do you want to basically undo your reset? It's not going to show up in your git log because you reverted it from that. However it will show up in your

    git reflog
    

    This will give you a listing of all your different branches.

    git reset HEAD@{1}
    

    Should fix your problem if your reset was the last thing you did.

提交回复
热议问题