Git 是一个分布式版本控制系统——它跟踪文件随时间的变化,让多个人可以协作,并保留项目的完整历史。它是软件开发中的主流版本控制工具,对几乎所有现代工作都至关重要。
版本控制的作用
text
Version control tracks CHANGES to code over time, providing:
✓ HISTORY — every change is recorded (who, what, when, why) → see how code evolved
✓ COLLABORATION — multiple people work on the same code without overwriting each other
✓ UNDO/RECOVERY — revert to any previous version; recover from mistakes
✓ BRANCHING — work on features in isolation; merge when ready
✓ BACKUP — the code lives in repositories (distributed copies)
Git 是分布式的
text
Every developer has a FULL COPY of the repository (entire history) locally:
→ work OFFLINE (commit, branch, view history without a network)
→ fast operations (local)
→ no single point of failure (every clone is a full backup)
→ vs centralized VCS (SVN) where there's one central server
→ "Distributed" = the repository is replicated, not centralized.
