Git is a distributed version control system, and its architecture revolves around four main areas:
1. Working Directory (Workspace)
-
This is where you work with files on your local machine.
-
You create, edit, delete files here.
-
These changes are not yet tracked by Git until you add them.
2. Staging Area (Index / Cache)
-
Think of it like a "draft box."
-
When you run
git add <file>, the changes go into the staging area. -
Git prepares these changes for the next commit.
3. Local Repository (.git folder)
-
When you run
git commit, changes from the staging area are stored in the local repository (inside the hidden.gitdirectory). -
This repository contains commits (snapshots), branches, and history.
-
Even without internet, your full project history is here.
4. Remote Repository (e.g., GitHub, GitLab, Bitbucket)
-
This is the shared repository where teams collaborate.
-
You push commits (
git push) to send changes to remote. -
You pull changes (
git pull) to bring updates from remote to local.
No comments:
Post a Comment