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

Question 'git checkout' - Git

On the video "Looking back on what we have done" I followed the steps using 'git log' 'git checkout 309c5'

however when I did that my file1, file2, and file3 all disappeared unlike on the video.

'ls' brought me solely README

309c5 was a commit to change the README file. It had nothing to do with file1 - 3.

When I do 'git master' they all come back

What is going on?

I am on OS X

1 Answer

Hi Jake,

When you do a git checkout, it's kind of like taking a new book down from the shelf. Your other books are still there, but you can't see the contents - you can only read the one currently in your hand. When you checked out commit XXXX, you have access to the files it contains, but not to master. When you switched back to master (checkout master) you put away the book called commit XXXX and grabbed another (master) instead. Hope that lame analogy helps clarify. :)

You can read more about branching and checkouts in the Git book.

Best, Cena

Im curious though, in the video, even before switching back to master, ls had file1 - file3 show up?