Before using Git, you need a repository. There are two ways to get one:
graph TD;
A["Want to Start with Git?"] -->|Initialize| B["git init 🏗️ (Create Local Repo)"];
A -->|Clone| C["git clone 🔗 (Copy Remote Repo)"];
style A fill:#ffcc00,stroke:#000,stroke-width:2px;
style B fill:#00ccff,stroke:#000,stroke-width:2px;
style C fill:#ff6600,stroke:#000,stroke-width:2px;
1️⃣ Initializing a Local Repository (`git init`)
The `git init` command creates an empty Git repository in your project directory.
The `git clone` command copies an existing repository from a remote source.
graph TD;
X["Run git clone"] --> Y["🗂️ Copies files & .git metadata"];
Y --> Z["Sets up remote connection 🔗"];
style X fill:#ffcc00,stroke:#000,stroke-width:2px;
style Y fill:#66ff99,stroke:#000,stroke-width:2px;
style Z fill:#ff6666,stroke:#000,stroke-width:2px;
3️⃣ Inside the `.git` Folder
Git creates a `.git` folder that contains all repository data, including:
HEAD: Points to the current branch.
objects/: Stores commits, blobs, trees.
refs/: Contains branch references.
config: Repository settings.
graph TD;
A[".git folder"] --> B["HEAD"];
A --> C["objects/"];
A --> D["refs/"];
A --> E["config"];
style A fill:#ffcc00,stroke:#000,stroke-width:2px;
style B fill:#00ccff,stroke:#000,stroke-width:2px;
style C fill:#ff6600,stroke:#000,stroke-width:2px;
style D fill:#66cc66,stroke:#000,stroke-width:2px;
style E fill:#ff9966,stroke:#000,stroke-width:2px;