What Makes a Repository a Repository?


Let’s jump back into using git. What makes a git repository a repository? Last lesson you interacted with an existing repository, the asteroids repository. For the most part it just looks like a normal directory on your machine. The only real difference is that git repositories store a bunch of metadata about the history of the repository since it was created. We won’t go into the details of how exactly this metadata is stored, but where is less complicated. It’s right here in the main directory. But it’s tucked away in a hidden directory. Meaning that it doesn’t show up in most file explorers by default. Hidden files and directories are often used for data that the user doesn’t need to directly interact with. These directories and files are only different from normal ones in that they start with a period which tells the operating system to hide it from the users. One way to see these files is by going to the command line and using ls -a. In addition to all the normal files that you see when you type ls, when you do ls -a, you also see the hidden files. See, here, you have hidden .git. So, how does this hidden .git directory even get there? Last time you cloned an existing repository, which transferred all that metadata over to your computer. If you want to start from scratch, you’ll need to explicitly tell git that you want to make a new repository. In the next video Caroline will show you how that works.

Daniel Ostrander

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *