Linus Torvalds wrote Git in 2005 to host the Linux kernel after the BitKeeper fallout. Twenty years later it is the version control system. Subversion still ships in places, Mercurial has loyalists, but for almost every new project the question isn't which VCS — it's which Git host.
← Back to Cross-Cutting Tools.git/).| Command | What it does |
|---|---|
git clone | Copy a remote repository, full history included. |
git status / diff | What's changed, what's staged. |
git add / commit | Stage files, then snapshot them with a message. |
git switch / checkout | Move between branches. |
git pull / fetch / push | Sync with a remote. fetch is read-only; pull is fetch + merge. |
git merge vs rebase | Both integrate work. Merge preserves history; rebase rewrites it onto a new base. |
git log / blame / bisect | Read history, find who changed a line, binary-search a regression. |
git stash | Set aside uncommitted work to switch contexts. |
git reflog | Your safety net — every HEAD movement is logged for ~90 days, even after "destructive" commands. |
Everyone commits to a single long-lived branch (main) at least daily. Short-lived feature branches that merge within a day or two. Releases are tags or release branches cut from trunk. This is what most modern high-velocity teams do — it forces small PRs, fast review, and feature flags for unfinished work. CI keeps trunk green.
Long-lived develop and main, plus feature, release, and hotfix branches. Designed for shipping versioned software with parallel maintenance. Heavy for SaaS where you ship continuously; still useful for libraries, mobile apps with app-store cycles, and embedded firmware.
Branch off main, push, open a pull request, get review, merge. The "default" workflow on GitHub/GitLab/Bitbucket. Pairs naturally with trunk-based development when branches are short-lived.
Each contributor has their own copy of the repo (a fork) and submits PRs upstream. The standard for open-source — the maintainer doesn't have to grant write access to every drive-by contributor.
git push --force rewrites the remote — anyone who'd pulled the old commits has to recover. Use --force-with-lease, and never force-push main.git filter-repo if needed. Pre-commit hooks (gitleaks, trufflehog) catch them earlier.git switch -c) before committing if you want the work to be findable.