Getting Started

Git Introduction

Learn Git — the version control system used by virtually every developer in the world.

What is Git?

Git is a distributed version control system (VCS) created by Linus Torvalds in 2005. It tracks changes to files over time, allowing you to recall specific versions later, collaborate with others, and maintain a complete history of your project.

Why Git?

  • History: See every change ever made, who made it, and why
  • Branching: Work on features independently without affecting the main code
  • Collaboration: Multiple developers can work simultaneously
  • Backup: Every clone is a full backup
  • Industry standard: Used by virtually every software company

Key Concepts

  • Repository (repo): A project with all its history
  • Commit: A snapshot of changes with a message
  • Branch: An independent line of development
  • Remote: A copy of the repo hosted online (GitHub, GitLab, etc.)
  • Working directory: Your local files
  • Staging area (index): Changes prepared for the next commit

Example

bash
# Install Git (if not already installed)
# Mac: brew install git
# Ubuntu: sudo apt-get install git
# Windows: Download from git-scm.com

# Configure Git (do this once)
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global core.editor "code --wait"  # use VS Code

# Check your configuration
git config --list

# Get help
git help
git help commit
git commit --help
Try it yourself — BASH