What is Git?
Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.Distributed
Every developer has a complete copy of the repository history, enabling offline work and flexible workflows
Fast & Scalable
Optimized for performance with projects of any size, from small scripts to massive codebases like the Linux kernel
Branching & Merging
Lightweight branches make it easy to experiment and merge changes with powerful merge strategies
Data Integrity
Cryptographic integrity ensures your code history is tamper-proof and recoverable
Why Use Git?
Git has become the de facto standard for version control in software development. Here’s why:Track Every Change
Git records the complete history of your project, allowing you to review changes, understand why code was written, and revert to previous states when needed.
Collaborate Seamlessly
Multiple developers can work on the same project simultaneously without conflicts, merging their work efficiently.
Experiment Safely
Create branches to try new features or fix bugs without affecting the main codebase. Delete them if they don’t work out.
Core Concepts
Repository
A Git repository is a database that stores the complete history of your project. When you rungit init, Git creates a .git directory containing:
- objects: The database storing all versions of your files
- refs/heads: Pointers to branch tips
- refs/tags: Named releases or milestones
- HEAD: Pointer to your current branch
The Three States
Files in a Git repository can be in one of three states:Working Directory
Working Directory
The actual files you’re editing on your computer. Changes here are not yet tracked by Git.
Staging Area (Index)
Staging Area (Index)
A preparation area where you assemble changes for your next commit. Use
git add to stage files.Repository (Committed)
Repository (Committed)
Permanently stored snapshots in your Git database. Use
git commit to save staged changes.Branches
Branches are lightweight, movable pointers to commits. The default branch is typically calledmaster or main. Creating a branch is instantaneous and switching between branches is fast.
How Git Tracks Content
Git tracks content, not files. Unlike many version control systems, Git’s
add command takes a snapshot of the file’s content at that moment and stages it for the next commit. If you modify the file again, you need to run git add again to stage the new changes.Git’s History
Git was originally written by Linus Torvalds in 2005 for Linux kernel development, with help from a group of hackers around the net. The name “git” was chosen as:- A random three-letter combination that’s pronounceable and not used by common UNIX commands
- British slang meaning “stupid, contemptible and despicable”
- Global Information Tracker (when it works well)
- Goddamn Idiotic Truckload of sh*t (when it breaks)
Getting Help
Git has extensive built-in documentation. You can access help for any command in two ways:git help -a to see all available commands, or visit the official documentation at https://git-scm.com/.
Next Steps
Ready to start using Git? Continue to the next sections:Installation
Install Git on your system
Quick Start
Make your first commit in 5 minutes
Tutorial
Complete guided tutorial with real examples
Commands
Browse all Git commands
Community Resources
- Mailing List: git@vger.kernel.org - Post bug reports, feature requests, and patches
- Archives: lore.kernel.org/git/ and marc.info/?l=git
- Security Issues: git-security@googlegroups.com (private disclosure)
- Official Site: git-scm.com
