Skip to main content

Git Command Categories

Git commands are organized into functional categories. Whether you are setting up a repository for the first time or recovering lost commits after a complex rebase, understanding these categories helps you find the right command fast.

Getting Started

The foundation of every Git workflow. git init creates a new repository, git clone copies an existing one, git config sets your identity, and git help provides documentation. Master these four commands before moving on — every other Git operation builds on them.

Working with Changes

The daily driver category. git status tells you the state of your working directory, git add stages changes, git commit records them permanently, and git diff shows exactly what changed. Most developers spend 80% of their time in this category.

Branching & Merging

Git's superpower. git branch creates isolated lines of development, git checkout/switch moves between them, git merge combines branches preserving full history, and git rebase creates a clean linear timeline. This is where Git outshines every other version control system.

Inspecting History

Five commands for exploring the past. git log shows commit history with powerful filtering, git show displays any commit in detail, git blame traces every line to its author, git reflog recovers lost commits, and git shortlog generates changelogs grouped by contributor.

Remote Repositories

Collaboration commands. git remote manages connections to hosted repositories, git push uploads your changes, git pull downloads and integrates remote changes, and git fetch downloads without merging. Understanding the push-pull-fetch cycle is essential for team workflows.

Stashing & Cleaning

Housekeeping commands. git stash temporarily shelves changes when you need to switch contexts, and git clean removes untracked files from your working directory. These commands keep your workspace organized.

Tagging & Releases

Release management. git tag marks specific commits as named releases (v1.0.0, v2.3.1), and git describe generates human-readable version strings from the nearest tag. Essential for CI/CD pipelines and software distribution.

Undoing Changes

Safety net commands. git reset moves branch pointers backward, git revert creates a new commit that undoes a previous one without rewriting history, and git restore provides a modern interface for file-level undos. Every developer needs these in their toolkit.

Browse all 28 commands with examples →