repository
▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲
▼▲▼▲▼▲▼
tags : #git
references : version control
▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲
▼▲▼▲▼▲▼
🧱 WHAT IS A REPOSITORY?
A repository (repo) is a container for:
your project files
the entire version history (commits)
the configuration files (like .git , .gitignore )
optional: branches, tags, hooks, and remote links
Think of it as a digital brain that remembers everything your project has gone through.
🧠 TYPES OF REPOSITORIES
1. Local Repository
Lives on your own machine.
Where you make commits, branches, etc.
Always created with:
git init
2. Remote Repository
Hosted on a platform (GitHub, GitLab, Bitbucket, Gitea, self-hosted).
Used for collaboration and backup.
Linked via URL:
git remote add origin https://github.com/yourname/project.git
You push to and pull from the remote. Local repo is your sandbox, remote is the shared
version.
⚙️WHAT’S INSIDE A GIT REPOSITORY?
When you do git init , Git creates a .git folder — that’s the true repo.
Inside .git , you have:
Folder/File Purpose
HEAD Points to the current branch
config Your Git repo settings
refs/ Contains branches and tags
objects/ All commits, blobs (file data), trees (directory structures)
index The staging area
hooks/ Automation scripts you can run pre/post actions
logs/ History of actions like switching branches
You can break your repo completely by messing with this. But mastering it gives you elite
control.
💡 GIT OBJECTS IN THE REPO
Git is like a content-addressable filesystem. It doesn’t store files directly. It stores:
Blobs: raw file content
Trees: directories with pointers to blobs and other trees
Commits: snapshots with metadata (author, date, message)
Tags: human-readable markers (e.g., v1.0 )
Refs: pointers to commits (branches, tags, HEAD)
Every object has a SHA-1 hash ID. That’s how Git stays secure and traceable.
🔗 CLONING A REPOSITORY
You don’t just get files — you get the entire history too:
git clone https://github.com/user/project.git
This gives you a full local repository with:
every commit
all branches
config and remotes set
🧠 BARE VS NON-BARE REPOSITORIES
✅ Non-bare repo
Contains .git folder and working directory.
For local development.
🏭 Bare repo
Contains only the .git data (no working files).
Used as central servers/remotes.
Cannot be used to write code directly.
git init --bare myproject.git
🔍 REPO COMMANDS CHEATLIST
git init # start a new local repo
git clone <url> # copy a remote repo
git remote -v # list linked remote(s)
git remote add origin <url> # link a remote
git push # send local commits to remote
git pull # get new commits from remote
git status # check what changed
git log # view history
git config # set repo-specific settings
📦 HOSTED GIT REPOSITORY PLATFORMS
Platform Notes
GitHub Most popular; excellent for open source
GitLab Great CI/CD integration
Bitbucket Used by teams in Jira/Atlassian ecosystem
Gitea Lightweight self-hosted
AWS CodeCommit, Azure Repos For cloud-native enterprise setups
🧨 COMMON PITFALLS
Deleting .git = repo is dead. Always have a remote backup.
Committing secrets (API keys) = security risk. Use .gitignore .
Not using branches = risky changes in production.
Confusing origin with upstream when forking.
🧙♂️ POWER TIPS
Use .gitignore to control what gets committed.
Use branches for every new feature or bugfix.
Use git tag to mark stable versions.
Use rebase to clean up commit history before pushing.
Always back up the .git folder for critical projects.
📌 TL;DR Summary
A repository is your project's brain — with full memory, history, and structure.
It can be local or remote, bare or non-bare.
Every repo has internal structure: objects, trees, commits, branches.
Tools like GitHub/GitLab manage remote repos and team collaboration.
Understanding a repo’s internals = mastering your project’s soul.