How to do it...

  1. Let's try to run the reflog command and limit ourselves to just the latest seven entries:
$ git reflog -7 

3061dc6 HEAD@{0}: checkout: moving from develop to master 
d557284 HEAD@{1}: merge feature/p-lang: Merge made by the 'recursive' strategy. 
9950c9e HEAD@{2}: revert: Revert "Revert "Merge branch 'feature/p-lang' into develop"" 
c46deed HEAD@{3}: reset: moving to HEAD^ 
2804731 HEAD@{4}: commit (merge): Merge branch 'feature/p-lang' into develop 
c46deed HEAD@{5}: revert: Revert "Merge branch 'feature/p-lang' into develop" 
a95abc6 HEAD@{6}: checkout: moving from master to develop 
In your repository, the commits will have different SHA-1 hashes due to the fact that the commits generated in the examples will have slightly different ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.