1

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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Hunsu
  • 3,281
  • 7
  • 29
  • 64

1 Answers1

3

If 7 is the oldest commit, then you'll do

git checkout HEAD^

otherwise, you'll use

git checkout HEAD@{1}
hjpotter92
  • 78,589
  • 36
  • 144
  • 183