🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

Git & GitHub

Learn version control with Git, understand key commands, and how GitHub enables collaboration on code projects.

What is Git?

Git is a distributed version control system that tracks changes to files over time. It allows multiple developers to work on the same codebase simultaneously, revert to previous versions, and maintain a complete history of every change ever made.

What is GitHub?

GitHub is a cloud-based platform that hosts Git repositories. It adds collaboration features like pull requests, code reviews, issue tracking, and CI/CD workflows on top of Git. GitHub is the world's largest code hosting platform with over 100 million developers.

Essential Git Commands

# Initialize a new repository
git init

# Clone an existing repository
git clone https://github.com/user/repo.git

# Check status of your changes
git status

# Stage files for commit
git add filename.txt
git add .   # Stage all changes

# Commit staged changes
git commit -m "Your commit message"

# Push to remote repository
git push origin main

# Pull latest changes from remote
git pull origin main

# Create and switch to a new branch
git checkout -b feature/my-new-feature

# Merge a branch
git merge feature/my-new-feature

Key Concepts

  • Repository (Repo) — A project folder tracked by Git.
  • Commit — A snapshot of your changes at a specific point in time.
  • Branch — An independent line of development. Use branches for new features.
  • Merge — Combining changes from one branch into another.
  • Pull Request (PR) — A proposal to merge your branch into the main codebase. GitHub's core feature.
  • Fork — A personal copy of someone else's repository on GitHub.
  • .gitignore — A file specifying which files Git should not track (e.g., node_modules, .env).

The Git Workflow

  1. Create or clone a repository.
  2. Create a new branch for your feature or fix.
  3. Make changes, stage them, and commit.
  4. Push your branch to GitHub.
  5. Open a Pull Request for review.
  6. After approval, merge into the main branch.

What's Next?

Set up your editor with VS Code Tips, or learn terminal basics with Command Line.