← All references

Git Commands Cheatsheet

Everyday Git commands grouped by the task you are trying to complete. Use the search field to quickly narrow this reference.

ValueName / formMeaning
git initStart a repositoryCreate Git metadata in the current directory.
git clone URLCopy a repositoryDownload a repository and its history.
git statusInspect stateShow changed, staged, and untracked files.
git add FILEStage a changeAdd a file’s current content to the next commit.
git commit -m "message"Record workCreate a commit from staged changes.
git switch -c NAMECreate a branchCreate and move to a new branch.
git pull --rebaseUpdate cleanlyFetch and replay local work above upstream changes.
git diffReview changesShow unstaged line changes.
git log --onelineView historyShow compact commit history.
git restore --staged FILEUnstage safelyRemove a file from the staging area without discarding edits.

How to use this reference

Search by a value, name, or keyword. The table is designed as a quick reminder while you code, debug, or review documentation. Examples are intentionally compact; verify environment-specific behavior in the official documentation for the platform you are using.