3 Creating a New Repository

Repositories in Git are stored on your local file system right alongside the code they track. You create a repository by typing git init in the directory that you want to start tracking files in.

You use two repositories in Git to collaborate with others: a private one and a public one. Your private repository—the one we’re creating here—is where you do all your work. It’s the repository with the working tree.

This two-tier system gives you the ability to track local experimental changes while only sharing changes via your public repository that are ready for others to work with. Be careful that you don’t allow yourself to code in a cave, though. Hoarding all your changes until they are “just right” ...

Get Pragmatic Guide to Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.