Skip to content

Latest commit

 

History

History
133 lines (100 loc) · 5.49 KB

README.md

File metadata and controls

133 lines (100 loc) · 5.49 KB

Git Basics — The Visual Git Handbook 🚀

A comprehensive, beginner-friendly repository dedicated to learning Git version control through clear step-by-step guides, cross-platform instructions, and visual diagrams.

Whether you prefer a visual interface (GitHub Desktop GUI) or the command line (Terminal CLI), this repository contains practical guides tailored to your workflow across both Windows and macOS.


🖥️ Cross-Platform Support: Windows & macOS

All tutorials in this repository provide native, first-class instructions for both operating systems:

Platform Recommended CLI Shell GUI Client Package Manager Install
🪟 Windows Git Bash (or PowerShell) GitHub Desktop for Windows winget install --id Git.Git -e --source winget
🍎 macOS Terminal.app (zsh / iTerm2) GitHub Desktop for macOS brew install git or xcode-select --install

Important

Line Ending Configuration (CRLF vs LF) To prevent cross-platform file conflicts between Windows (CRLF) and macOS (LF), configure Git before you start:

  • On Windows: git config --global core.autocrlf true
  • On macOS: git config --global core.autocrlf input

📚 Learning Guides

Guide Target Audience Description Link
Git CLI Tutorial Developers, DevOps, Terminal users Master core Git commands (status, add, commit, push, pull), branching, merging, stashing, line endings, and conflict resolution on Windows & macOS. Read CLI Guide →
Git GUI Tutorial Designers, Beginners, Non-terminal users Simple point-and-click version control with GitHub Desktop. Full setup instructions and keyboard shortcuts for both Windows & macOS! Read GUI Guide →

🧭 Git Architecture at a Glance

Understanding the four core areas of Git makes version control intuitive:

Git Architecture & The 4 Fundamental Areas

  • Working Directory: The active files you edit locally (C:\... on Windows or /Users/... on macOS).
  • Staging Area: The preparation zone where files are staged (git add) for the next snapshot.
  • Local Repository: The committed history on your machine (git commit).
  • Remote Repository: The cloud-hosted repository on GitHub (git push / git pull).

⚡ Quick Command Cheat Sheet

1. Setup & Configuration (Windows & macOS)

# Identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

# Line Endings (Run the one matching your OS)
git config --global core.autocrlf true   # 🪟 Windows
git config --global core.autocrlf input  # 🍎 macOS

2. Daily Save Cycle

git status               # View modified & untracked files
git add <file>           # Stage specific file (or `git add .` for all)
git commit -m "summary"  # Record staged files as snapshot
git pull origin main     # Pull team updates
git push origin main     # Publish commits to GitHub

3. Branching & Merging

git branch                      # List local branches
git switch -c feature/new-page  # Create and switch to new branch
git switch main                 # Switch back to main branch
git merge feature/new-page      # Merge changes into current branch
git branch -d feature/new-page  # Delete branch after merge

4. Shelving & Undoing

git stash               # Temporarily stash dirty uncommitted work
git stash pop           # Restore stashed changes
git restore <file>      # Discard uncommitted changes in working directory
git restore --staged <f> # Unstage file without losing changes
git revert <commit>     # Safely invert an existing committed change

📁 Repository Structure

git-basic/
├── README.md                          # Repository hub, cheat sheet & documentation notes
├── docs/
│   ├── git-cli-tutorial.md            # Comprehensive Git CLI command-line guide (Windows & macOS)
│   └── git-gui-tutorial.md            # GitHub Desktop point-and-click guide (Windows & macOS)
└── images/
    ├── cli/                           # Visual architecture & terminal diagrams
    │   ├── 1-git-architecture.svg
    │   ├── 2-daily-workflow.svg
    │   ├── 3-branch-merge.svg
    │   ├── 4-git-stash.svg
    │   └── 5-conflict-resolution.svg
    └── gui/                           # Visual mockups for GitHub Desktop interface
        ├── 1-signup.svg
        ├── 2-download-desktop.svg
        ├── 3-create-repo.svg
        ├── 4-commit-push.svg
        └── 5-history.svg

📝 Commit Conventions

We recommend following the Conventional Commits specification:

  • feat: A new feature or capability.
  • fix: A bug fix.
  • docs: Documentation changes only.
  • style: Code formatting, white-space, or styling without logic changes.
  • refactor: Code restructuring without fixing a bug or adding a feature.
  • chore: Maintenance tasks, dependency updates, or build configs.

Example: feat: add user authentication middleware


🤝 Contributing & Usage

Feel free to clone this repository, explore the guides, and share it with your team. If you find typos or have suggestions for additional diagrams, pull requests are warmly welcomed!