Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSergi Beltran
18,493 PointsI can't pass last objective of "Getting Started With Git"
Hi everyone, I have problems to pass the 11 objective (the last objective), that say something this:
"HEAD~1 is a special commit identifier in git; it stands for the previous commit (not the one we just made, but the one before that). Can you use that identifier to check out the previous commit in this repository?"
I have tried several options like:
git checkout "identifier commit"
git checkout master
diff "identifier commit" "identifier commit"
But each one of this is wrong.
Can anyone help me?
Thank you!
7 Answers
John W
21,558 Pointsso you tried git checkout "identifier commit"
?
Well, the syntax is actually git checkout <identifier>
So all you have to do is insert the identifier of whatever you want to checkout, i.e. HEAD~1
, just like it says in the question.
Sergi Beltran
18,493 PointsThank you John to answer my question. In fact, I'm trying to do that, but i don't know what I'm doing wrong.
I've recorded a video to show you what I do, may you can see my failure.
Thank you.
REVAsia MY
15,581 Pointsthe answer is:
git checkout HEAD~1
Tommy Morgan
Treehouse Guest TeacherSergi Beltran - the identifier in this case is HEAD~1, not the commit sha (which you appear to be looking up and entering, based on your video). It's actually a special name that git knows how to process, so you can use it without having to look up and copy the giant cumbersome commit sha.
Darrius Taylor
1,934 PointsSo why doesn't git reset --soft HEAD~1 work? Is it just defined answers or does it actually run the command to check?
Tommy Morgan
Treehouse Guest TeacherDarrius Taylor we check the answer before running it, and it's based on what we've covered in the videos, so git reset --soft HEAD~1
isn't the answer we're looking for. We might want to accept that answer for people who are already familiar with git, though, so I'll review the code challenge. Thanks!
Sergi Beltran
18,493 PointsHi everyone, thank you very much for your help.
Yes, it was HEAD~1, problem solved :)
MUZ1407800 Doubt Milazi
11,813 Pointscan you pos t your answer man because i am stuck
MUZ1407800 Doubt Milazi
11,813 Pointscan you pos t your answer man because i am stuck
Kate Farrell
2,320 PointsI think it would be beneficial for the order of the tasks to be changed slightly. Task 11 out of 11 is a simple checkout HEAD command, but this more challenging task is before it (task 9/11 I think)
REVAsia MY
15,581 Pointsthe answer is:
git checkout HEAD~1
Jeremy Barbe
8,728 PointsJeremy Barbe
8,728 PointsI don't believe "checkout" has ever discussed in this course, so if that's the answer, I didn't learn it.