DEV Community


Discussion on: How to move forward and backward between commits in git

michaelcurrin profile image

If you want to be more precise you can use relative references

Start the log as if we were 5 commits behind.

git log HEAD~5

And you can check it out or reset.

git reset HEAD~5
git checkout HEAD~10

And reference future commits when you go back like that.

git log HEAD^10