
Git Cheat Sheet
65+ Git commands with descriptions, flags, and examples. Search, filter by topic, click to copy. Includes workflow diagrams.
Last reviewed: April 2026New to this tool? Click here for instructions
How to Use This Git Reference
This Git Cheat Sheet provides a comprehensive reference for Git commands, including descriptions, flags, and examples. To use this tool effectively, follow these steps:
1. Search by Keyword: Type any keyword into the search bar to find relevant Git commands instantly.
2. Browse by Topic: Click on a topic chip (Setup, Commits, Branches, etc.) to see only that group of commands.
3. Copy Commands: Click any row to copy the command directly to your clipboard.
4. View Workflow Diagrams: The Workflow tab includes diagrams for Feature Branch, Gitflow, and Trunk-Based Development workflows to help you understand best practices.
When to Use This Tool in Real Workflows
This Git Cheat Sheet is ideal for developers who need quick access to Git commands and workflows. It is particularly useful in the following scenarios:
1. New to Git: If you are new to Git, this tool can help you understand the basics and common workflows.
2. Team Collaboration: For teams working on projects, this tool can serve as a quick reference for everyone to ensure consistency and efficiency.
3. Feature Branch Workflow: When working with feature branches, this tool can help you understand how to create, merge, and manage branches effectively.
4. Trunk-Based Development: For teams practicing continuous deployment, this tool can provide insights into short-lived branches and feature flags.
How It Works
This Git Cheat Sheet is a static website that provides an interactive reference for Git commands and workflows. It is built using HTML, CSS, and JavaScript, and it does not require any external tools or services to function.
The website includes a search bar, topic filters, and a command list. Each command includes a description, flags, and examples. Workflow diagrams are also provided to help users understand best practices.
Tips, Edge Cases, or Limitations
While this Git Cheat Sheet is a valuable resource, it has some limitations:
1. Offline Access: Since it is a static website, you need an internet connection to access the reference.
2. No Real-Time Updates: The reference is static and does not update in real-time. For the latest information, refer to official Git documentation.
3. Limited Customization: You cannot customize the reference or add new commands directly. However, you can bookmark the page for easy access.
4. No Code Beautification: This tool does not include a code beautifier. For code formatting, consider using external tools or services.
Frequently Asked Questions
Quick reference
| Command | Description | Common Options | Example |
|---|---|---|---|
| git init | Initialize new Git repository | -q (quiet mode) | git init -q |
| git add | Stage files for commit | . (all files), -f (force) | git add -f README.md |
| git commit | Record changes to repository | -m "message", --amend | git commit -m "Fix bug" |
| git status | Show working tree status | -s (short format) | git status -s |
| git branch | Manage branches | -d (delete), -a (list all) | git branch feature-1 |
| git merge | Merge specified branch | --no-ff (disable fast-forward) | git merge --no-ff dev |
Example walk-through
Worked example: step-by-step
Step 1. Open terminal and navigate to your project directory. Use git init to initialize a new repository.
git init
Step 2. Create a new file (e.g., README.md) and add it to the staging area with git add.
git add README.md
Step 3. Commit your changes using git commit -m "Initial commit" to save the snapshot.
git commit -m "Initial commit"
Step 4. Push your code to a remote repository (e.g., GitHub) with git push origin main.
git push origin main
Step 5. Resolve merge conflicts by editing the conflicting file, then mark resolved with git add and continue merging.