Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Can you specify which file version to go back to if you committed the file numerous times in a local machine?
For example, If I commit a file and get its first version. I make changes to it later on and commit the new changes to get a second version. I do it again with another change and commit it a third time. At this point, would I be able to go back to the first version? Or am I stuck at only have two versions (2nd and 3rd version) at a time and I'm only able to go back to the second version.
I've gone through this section in the git course, but I'm not sure if I missed a lesson where this is a possibility
You can go back to any version. Say your last three commits change the same file:
f116d82 third version 18bdc5d second version a65d770 first version
If you want to go back and have the first version, you can go back to that version using the specific SHA:
git reset --hard a65d770
Haven't found this specific case to happen often in real life, though. It's more common for me to revert the changes of a commit to go back to a previous version. Hope this helps