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 Git Basics Workflows A Day in the Life of a Git Project

Back to Where I started.

Hi , Belows are my logs.

How to backtrack to the commited code ( commit c42a9908b9f4645d74378b6d40e7a4ba4539d12e : Initial Commit Rails Applications )

to start all over again at that stage instead of remove or erased my current code which I was mess up. kindly advise. Thank you.

C:\Treehouse\Project\odot (master)
Ī» git log
commit dde16eda59dee08b56c01524f6b0b5323e86fb5b
Author: 1073113 <1073113@gmail.com>
Date:   Sun Apr 19 14:48:13 2015 +0800

    Generate todo_list scaffold

commit d57f87c25572ec4f4daba1aa991dbb9ccce3290a
Author: 1073113 <1073113@gmail.com>
Date:   Sun Apr 19 14:15:22 2015 +0800

    Removed test directory

commit 63ea25bedc44cc3c3d36efedfa53dd976f60c2c8
Author: 1073113 <1073113@gmail.com>
Date:   Sun Apr 19 14:13:37 2015 +0800

    Add rspec and capybara

commit c42a9908b9f4645d74378b6d40e7a4ba4539d12e
Author: 1073113 <1073113@gmail.com>
Date:   Sun Apr 19 14:02:20 2015 +0800

    Initial Commit Rails Applications

C:\Treehouse\Project\odot (master)

1 Answer

Justin Black
Justin Black
24,793 Points

easiest way since the code is messed up and doesn't really matter if you destroy the history would be a reset.

git reset --hard c42a9908b9f4645d74378b6d40e7a4ba4539d12e

this would take you all the way back to your first commit. the code listed there is listed in the log next to the word "commit" and each commit has a unique code.