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 trialSarah Breidenbach
4,490 PointsI don't understand how this would work in a real project. Can I do this on my computer instead of in Workspaces?
If I create the same HTML files and put them in a regular folder on my Mac will that be the same as using the files that are in the Workspace sidebar? Or does that defeat the purpose of creating a repository? A repository is another folder right? So would I want two folders? The one holding the files I'm working on and also the responsitory holding the backup of those files? I'm confused how this example translates into a real life scenario. Is this only for collaborations? I don't think I'm getting the bigger picture.
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! Yes, of course, you can use git
from your local computer and it will work with your file system whether it's macOS, Windows, or Linux. When you use git init
inside a folder, it automatically creates a .git
folder within the directory you are currently working. Git is used to not much as a backup, but rather to snapshot your files in time. It is a "version control system." That likely sounds really fancy, but I'll bet you've used your own "version control system" before, but sort of self-made.
Ever have a fancy document you need to write up for a meeting/proposal or something? Or even a picture you're editing for use somewhere? Let's assume that it's a Word document. Chances are you did some work on it and saved it as something like "Doc1.docx". You go and do some more edits on it, but you aren't sure you like them. So you save it as "Doc2.docx". Then you do even more edits, but you don't want to lose your first 2 versions (just in case), so you save it as "Doc3.docx". This is an ad-hoc version control system although, you are duplicating your files.
Git does this same sort of thing except it's your changes and "commits" that are saved as that "snapshot in time". If you were then to do something that broke your code, you could go back in time and look at how your code was before it broke. And it does all this without file duplication.
Later on, you will learn about GitHub, which is one of the ways we store a copy of our repository out on the web so that we can collaborate with others and so that we have a backup of our code in case anything catastrophic happens to our local system.
Hope this helps!
I highly encourage you to install git on your local system and give it a go! We learn the most by doing
Colton Ehrman
255 PointsI'm not sure exactly what it is you are asking.
Git is intended a version control tool, simply meaning that it is used to easily control different versions of your project. It is a very useful tool and allows for some complex version control within your project. After using it a bit you will start to see the purpose behind it.
Sarah Breidenbach
4,490 PointsSarah Breidenbach
4,490 PointsThanks to both responders. So am I correct in thinking that there is one folder that holds the project files I am working on and then a different, second folder, which is the repository, that only holds the changes made and not the complete project? I'm sure I will understand better once I finish the tutorial and try it out.