Repositories
๐ The everyday picture
A project folder with a very careful librarian living inside it, writing down every change.
๐What it really is
- A repository (or repo) is a project folder that Git is tracking.
-
git initturns an ordinary folder into a repository. Git creates a hidden.gitfolder inside, where it keeps the whole history. Never edit or delete.gitby hand: deleting it deletes the history. -
git statusis the question you'll ask most: "what's changed since my last save?" - A
.gitignorefile lists things Git should never track, such as.envfiles with secrets, or large folders of downloaded packages.
๐ฑ๏ธTry it
In VS Code's terminal, inside my-first-site:
git init
git status
Git reports that index.html is untracked: it exists, but Git isn't recording it yet. Now create a file
called .gitignore containing the single line .env.
โ Quick check
What's inside the hidden .git folder?
Show the answer
The repository's entire history. Deleting it removes the history, not your current files.
Why add .env to .gitignore?
Show the answer
So secret values in .env are never recorded by Git or uploaded to GitHub.
