Git Cheat Sheet 2026 — Quick Command Reference
Git Cheat Sheet is the complete quick-reference of Git commands grouped by function. Copy any command with one click and find what you need with Ctrl+F in under 3 seconds.
Staging & Status
| Action | Command | Useful flags |
|---|---|---|
| Create an empty Git repository |
|
|
| Clone a remote Git repository from the internet |
|
|
| View the status of the local repository |
|
|
| Stage all changes for a commit |
|
--all |
| Commit changes to version history |
|
--message |
| Push local commits to a remote repository |
|
|
| Pull any changes made to a remote |
|
|
| Reset everything the way it was in the latest commit |
|
--hard --force |
Commits
| Action | Command | Useful flags |
|---|---|---|
| Open an editor to write a message and commit staged files to the repository |
|
|
| Commit staged files to the repository with the specified message |
|
--message |
| Commit staged files with a message read from a file |
|
--file |
| Auto stage all modified and deleted files and commit |
|
--all --message |
| Commit staged files and sign them with the specified GPG key (or the one defined |
|
--gpg-sign --message |
| Update the last commit by adding the currently staged changes, changing the comm |
|
--amend |
| Commit only specific (already staged) files |
|
|
| Create a commit with the specified message and description |
|
--message |
Branches
| Action | Command | Useful flags |
|---|---|---|
| List all branches (local and remote; the current branch is highlighted by `*`) |
|
--all |
| List which branches include a specific Git commit in their history |
|
--all --contains |
| Show the name of the current branch |
|
--show-current |
| Create new branch based on the current commit |
|
|
| Create new branch based on a specific commit |
|
|
| Rename a branch (you must switch to a different branch before doing this) |
|
--move |
| Delete a local branch (you must switch to a different branch before doing this) |
|
--delete |
| Delete a remote branch |
|
--delete |
Remotes & Sync
| Action | Command | Useful flags |
|---|---|---|
| List existing remotes with their names and URLs |
|
--verbose |
| Show information about a remote |
|
|
| Add a remote |
|
|
| Change the URL of a remote (use `–add` to keep the existing URL) |
|
|
| Show the URL of a remote |
|
|
| Remove a remote |
|
|
| Rename a remote |
|
|
Stash
| Action | Command | Useful flags |
|---|---|---|
| Stash the current uncommitted changes |
|
|
| Stash current changes, including new untracked files |
|
--include-untracked |
| Interactively select parts of changed files for stashing |
|
--patch |
| List all stashes |
|
|
| Show the changes as a patch between the stash and the commit back when stash ent |
|
--patch |
| Apply a stash and remove it from the stash list if applying doesn’t cause confli |
|
|
| Delete the latest stash |
|
|
| Delete all stashes |
|
|
Rebase & History
| Action | Command | Useful flags |
|---|---|---|
| Rebase the current branch on top of another specified branch |
|
|
| Start an interactive rebase, which allows the commits to be reordered, omitted, |
|
--interactive |
| Continue a rebase that was interrupted by a merge failure, after editing conflic |
|
--continue |
| Continue a rebase that was paused due to merge conflicts, by skipping the confli |
|
--skip |
| Abort a rebase in progress (e.g. if it is interrupted by a merge conflict) |
|
--abort |
| Move part of the current branch onto a new base, providing the old base to start |
|
--onto |
| Reapply the last 5 commits in-place, stopping to allow them to be reordered, omi |
|
--interactive |
| Auto-resolve any conflicts by favoring the working branch version (`theirs` keyw |
|
--strategy-option |
| Show the sequence of commits starting from the current one, in reverse chronolog |
|
|
| Show the history of a particular file or directory, including differences |
|
--patch |
| Show an overview of which file(s) changed in each commit |
|
--stat |
| Show a graph of commits in the current branch using only the first line of each |
|
--oneline --graph |
⚠️ Dangerous / Destructive Commands
These commands are irreversible. Verify your environment (dev/staging vs prod) before running them.
| Action | Command | Warning |
|---|---|---|
| ⚠️ Delete |
|
Irreversible — verify the target before running |
| ⚠️ Push |
|
Irreversible — verify the target before running |
| ⚠️ Stash drop |
|
Irreversible — verify the target before running |
FAQ — Frequently Asked Questions
What is the difference between Staging & Status and Commits?
Each group in this Git cheat sheet covers a distinct area. Staging & Status focuses on its specific scope, while Commits and the remaining groups cover networking, storage, security and diagnostics respectively.
How do I check the installed Git version?
Run the version command (usually git version or git --version). The output shows the client and, when applicable, the server version.
Why does Git return ‘permission denied’?
A ‘permission denied’ error in Git usually means the current user lacks sufficient privileges or credentials are not configured. Check: (1) assigned IAM/RBAC roles, (2) an active authentication context via the corresponding login command.
How do I filter Git output by status or name?
Use flags such as --filter, --selector or --query depending on the tool. You can also pipe into grep or jq to process JSON:
git list | grep RUNNING
What is the fastest way to debug a Git error?
Add the verbose flag (--verbose, -v or --debug) to the failing command. This reveals the underlying HTTP/API calls and the full error response body.
Official sources & references
Commands cross-checked against vendor documentation and high-authority repositories: