A Git repository is your project folder combined with the complete history of every change ever committed to it. The files you see are only half of it; the other half is a hidden .git directory that stores all your commits, branches, tags, and settings. Together they make up the repository, often shortened to "repo." Because the full history lives right alongside the files, you can browse old versions, switch branches, or undo changes entirely on your own machine, with no server required.
What a repository contains
When you turn a folder into a repository, Git creates a hidden subfolder named .git. That folder is the repository in the technical sense. Inside it Git keeps the object database of every snapshot, the pointers that define your branches and tags, and configuration like your remotes. Your visible project files are called the working directory; the .git folder is the memory behind them.
Delete the .git folder and you are left with plain files and no history. Keep it, and you carry the entire timeline of the project wherever the folder goes.
Local versus remote repositories
Git is distributed, which means there is no single master copy by default. Every clone is a complete repository with the full history.
| Type |
Where it lives |
Used for |
| Local repository |
Your own machine |
Daily work, commits, branching offline |
| Remote repository |
A server such as GitHub |
Sharing, collaboration, and backup |
| Bare repository |
A server, with no working files |
Acting as the central remote others push to |
You work in your local repo and push to a remote so teammates can pull your changes. A remote on a hosting service is also your backup; until you push, your history exists only on your computer. For the hands-on flow of pushing and pulling, see how to use Git and GitHub.
How to create a repository
There are two starting points: make a new one, or copy an existing one.
git init // turn the current folder into a new repo
git add .
git commit -m "initial commit"
// or copy an existing project, history and all
git clone https://github.com/org/project.git
git init creates the hidden .git folder so Git starts tracking. git clone downloads a full repository, including its entire history, and sets up a link back to where it came from.
How to keep a repository healthy
- Add a gitignore file early so build output, secrets, and system files never get committed.
- Push to a remote regularly so your work is backed up off your machine.
- Keep one repository per project rather than cramming unrelated projects together.
- Write a short README so anyone who clones the repo knows what it is and how to run it.
- Make small, frequent commits so the history stays readable and useful.
What to skip
- Skip committing large binaries like videos or datasets into the repo; they bloat the history and are awkward to remove later.
- Skip committing secrets such as API keys or passwords. Once committed and pushed, they are effectively public.
- Skip nesting one repository inside another by accident; it creates confusing, hard-to-track state.
- Skip deleting the .git folder unless you truly want to discard all history.
FAQ
Is a repository just a folder?
It is a folder plus a hidden .git directory that stores the full change history. The visible files alone are not a repository; the .git folder is what makes it one.
What is the difference between a local and remote repository?
A local repository lives on your machine and is where you do daily work. A remote repository lives on a server and is used for sharing with others and backing up your history.
How do I start a repository?
Run git init inside a project folder to create a fresh one, or git clone with a URL to copy an existing repository, including its complete history, onto your computer.
Does every clone have the full history?
Yes, in normal use. Git is distributed, so each clone is a complete repository with the entire commit history, which is why you can work and view history fully offline.
Where to go next
See how commits build the history a repo stores, understand branches within a repository, and learn how Git differs from GitHub.