Git Commands Cheatsheet
Everyday Git commands grouped by the task you are trying to complete. Use the search field to quickly narrow this reference.
| Value | Name / form | Meaning |
|---|---|---|
| git init | Start a repository | Create Git metadata in the current directory. |
| git clone URL | Copy a repository | Download a repository and its history. |
| git status | Inspect state | Show changed, staged, and untracked files. |
| git add FILE | Stage a change | Add a file’s current content to the next commit. |
| git commit -m "message" | Record work | Create a commit from staged changes. |
| git switch -c NAME | Create a branch | Create and move to a new branch. |
| git pull --rebase | Update cleanly | Fetch and replay local work above upstream changes. |
| git diff | Review changes | Show unstaged line changes. |
| git log --oneline | View history | Show compact commit history. |
| git restore --staged FILE | Unstage safely | Remove 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.