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 trialDan Williams
5,339 PointsGit Basics Getting Started With Git An Old-Fashioned Git-Together stuck on code challenge
I'm following the Git Basics Getting Started With Git deep dive.
I'm stuck on the the 9th challenge which is named
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?
Any guides or help where to start with this, kind stuck....
8 Answers
Dan Williams
5,339 PointsCan you tell me where in the videos this was covered and I will review?
Pawel Wronski
8,872 Pointsgit checkout HEAD~1
Robbie Thomas
31,093 PointsI tried git checkout HEAD and not HEAD~1. They let me pass!
Dan Williams
5,339 PointsAha, sorted it, thanks for the support! ;-)
Mário Ribeiro
10,439 PointsHello Tommy,
I'm having problems with the ~ symbol. I'm unable to use it.. already tried copy / paste without success. Restarted the challenge over 20 times :)
Thank you.
Mário Ribeiro
10,439 PointsNow solved. Tried a couple of times again, and worked..
Iván Murillo
11,912 PointsHey Mário! I'm having problems too with the ~ symbol. How did you solved it?
EDIT: The ~ symbol doesn't work in the treehouse's console if you are using a non-american keyboard. Solved with a copy and paste!
Dave Huish
17,727 PointsThe confusion for me was the words "check out". I thought initially I had to look add the log. Instead, it is literally asking you to access the files using Git's checkout.
git checkout HEAD~1 is what I ended up with.
I was making it far too complicated for myself.
Tommy Morgan
Treehouse Guest TeacherHey Dan Williams -
Have you tried anything at all here yet, or are you not sure what to try? I'd be glad to give you some hints :)
Dan Williams
5,339 PointsHi Tommy, I've tried multiple things...but I'm not sure If I'm barking up the wrong tree!
I thought git reset HEAD -- index.hmtl but have had no luck..
Tommy Morgan
Treehouse Guest TeacherWell, there's a bit of a clue in the question:
...Can you use that identifier to check out the previous commit in this repository?
This question is asking you to switch to a different version of the code in your repository. There's a command we covered for doing just that :)
Also, remember that commit identifiers in Git are typically mangled-looking strings that are guaranteed to be unique, like 1a8bc38cd3942fea83f4b2dc3251. In this case, though, we're making use of a "special" commit identifier - it's not a hash string like normal, but it's a special keyword that Git knows always means "the second most recent commit."
Tommy Morgan
Treehouse Guest TeacherTommy Morgan
Treehouse Guest TeacherChecking out specific versions of the code was covered in this video:
http://teamtreehouse.com/library/programming/git-basics/getting-started-with-git/looking-back-on-what-weve-done