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

Christopher Leonard
Christopher Leonard
11,172 Points

Interacting with files with Git

Maybe I missed something in the track, but I haven't seen how we get our files into and out of git. The Git foundations badge is great and easy to follow, but how do we interact with our files (say something we did in SublimeText2) with Git in the console?

1 Answer

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

With Git you're not really moving files around your file system exactly. When you set up a Git repository -- which is as simple as going to the main directory for your project and typing git init -- Git can now track those files, but those files are still in the same place on your computer. You can use SublimeText2 (or any text editor) to work on those files. When you're ready to commit your changes you then

  • check them in to the staging area git add .
  • commit them to the repo git commit -m "my commit message"

In other words, you can continue to edit your files using your regular text editor, then use the console and Git to track the changes. There's more to it than that, of course, but those are the basics. I'd recommend going through the course again, if you're confused, because Git is a GREAT tool to learn and use.

Christopher Leonard
Christopher Leonard
11,172 Points

Thanks Dave! I still have two badges left in the Git Basics course, so perhaps it's something that will be covered there. It just seemed like a huge, crucial piece of info that hadn't been presented.