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 Introduction to Git Managing Committed Files Discarding File Modifications

This command brings back a file version that has already been committed right?

Just want to make sure, the file you want to revert back to should have been committed first?

1 Answer

Yes. An easier way to think about this command, though, is that it will wipe out any changes to the file that appear when running git diff. Let me know if this helps!

The command "git diff" should show the difference between modified and staged. If "git diff" shows nothing after the command "git checkout -- [filename]", doesn't it mean that the file in directory was overwritten by the file staged?