Explore in-depth, the nuts and bolts of git repositories - understanding what they contain, how to initialize one, navigate them using Visual Studio Code, and effectively utilize Source Control panel.
This exercise is excerpted from Noble Desktop’s Git & GitHub training materials and is compatible with updates through 2022. To continue learning web development with hands-on training, check out our coding bootcamps in NYC and live online.
Git Repositories
A Git repository (or repo for short) contains all of the project files and the entire revision history. You’ll take an ordinary folder of files (such as a website’s root folder), and tell Git to make it a repository. This creates a .git subfolder, which contains all of the Git metadata for tracking changes.
On Unix-based operating systems such as macOS, files and folders that start with a period (.) are hidden, so you will not see the .git folder in the macOS Finder unless you show hidden files, but it’s there. You won’t ever need to go into the .git folder, so don’t worry about not being able to see it.
TIP: On macOS you can show or hide invisible files by hitting Cmd–Shift-Period(.)
Initialize a Git Repo
-
Open a project folder in Visual Studio Code.
You can do this by going to File > Open (Mac) or File > Open Folder (Windows), navigate to the folder, select it, and hit Open (Mac) or Select Folder (Windows).
- Open the Source Control panel
on the left of the window.
In the Source Control panel
click Initialize Repository.