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 trial

Development Tools

Sergi Beltran
Sergi Beltran
18,493 Points

I 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

so 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.

Jeremy Barbe
Jeremy Barbe
8,728 Points

I don't believe "checkout" has ever discussed in this course, so if that's the answer, I didn't learn it.

Sergi Beltran
Sergi Beltran
18,493 Points

Thank 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.

http://youtu.be/H8wzv_gbMqc

Thank you.

REVAsia MY
REVAsia MY
15,581 Points

the answer is:

git checkout HEAD~1

Tommy Morgan
STAFF
Tommy Morgan
Treehouse Guest Teacher

Sergi 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
Darrius Taylor
1,934 Points

So 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
Tommy Morgan
Treehouse Guest Teacher

Darrius 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
Sergi Beltran
18,493 Points

Hi everyone, thank you very much for your help.

Yes, it was HEAD~1, problem solved :)

can you pos t your answer man because i am stuck

can you pos t your answer man because i am stuck

Kate Farrell
Kate Farrell
2,320 Points

I 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
REVAsia MY
15,581 Points

the answer is:

git checkout HEAD~1