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 Getting Started With Git Looking Back on What We've Done

Daniel Hildreth
Daniel Hildreth
16,170 Points

Git Checkout Acting Weird

So I have an interesting question here. I'm following along with Tommy, and everything seems to be fine till I get to the Git checkout area or the video. I'm following along in the Treehouse Console, and whenever I go to checkout one of the commits, it seems to erase the other commits. I've had it twice do this to me. I've had it erase my file1, file2, and file3; it has also erased the file2 and file3 when I restarted the Console and re-entered my files and such. Anyone know what's going on?

Daniel Hildreth
Daniel Hildreth
16,170 Points

To try and help clarify, I keep getting a warning message saying something like "warning you are leaving x commits behind..." And then it deletes them when I type in LS command after seeing this warning. So I'm really confused here.

1 Answer

it hasn't erased the commits, you just checkout a branch area to a time before you made any changes to them. If you want to checkout all branches with the changes you have made type git checkout master. If you want to make changes while in checkout mode and commit them permanently, you need to type git checkout -b new_branch_name