QuickRef.
Reference

Git Cheat Sheet Reference

The everyday Git commands for staging, committing, branching, and syncing, kept to the ones you actually run in a normal day.

At a glance

Key facts
Model

Distributed, local first

Created

By Linus Torvalds, 2005

Daily loop

Status, add, commit, push

Branches

Cheap, use them freely

Everyday commands

14 rows
CommandWhat it does
git statusShow staged and unstaged changes
git add <file>Stage a file for the next commit
git add -AStage every change
git commit -m "msg"Record staged changes with a message
git log --onelineShow a compact commit history
git diffShow unstaged line by line changes
git branchList local branches
git switch -c <name>Create and switch to a branch
git merge <branch>Merge a branch into the current one
git pullFetch and merge from the remote
git pushSend local commits to the remote
git clone <url>Copy a remote repository locally
git restore <file>Discard unstaged changes to a file
git stashShelve changes to reapply later

Where it comes from

Git is the distributed version control system created by Linus Torvalds in 2005 to manage Linux kernel development. Because every clone holds the full history, most work happens locally and only a push or pull touches the network. The commands below are drawn from the official Git documentation and cover the core loop nearly every project relies on, rather than the full command surface.

How to use it

The daily rhythm is small and repeats. You check status to see what changed, stage the files you mean to keep with add, record them with a commit and a clear message, and push to share. Branching keeps unfinished work off the main line: create a branch, commit on it, then merge it back when it is ready. When you need to line up with others, pull to fetch and merge their commits first. Keep commits focused and messages in the imperative mood, for example add login form rather than added login form, so the log reads like a list of instructions.

This page is a standing reference at a fixed URL, built to be linked and cited. The data here is compiled from the official Git documentation (git-scm.com).

See also