Reputation: 3391
Imagine I have this history 7-6-5-4-3-2-1-(first-commit) Now I do the following command to go the commit 3 :
git checkout HEAD~3
What I should to go the commit 4? I tried git checkout HEAD~-1
but it's not the right syntax. We assume that there's no other branch.
Upvotes: 1
Views: 1147
Reputation: 80657
If 7 is the oldest commit, then you'll do
git checkout HEAD^
otherwise, you'll use
git checkout HEAD@{1}
Upvotes: 3