Git Cheat Sheet

65+ Git commands with descriptions, flags, and examples. Search, filter by topic, click to copy. Includes workflow diagrams.

Last reviewed: April 2026

New to this tool? Click here for instructions

65 commands - Click any row to copy. Use Search to filter.

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

Git is a distributed version control system created by Linus Torvalds in 2005. It tracks file changes over time, enables team collaboration, and stores a complete history of every change ever made to a project.
Merge creates a merge commit that preserves full branch history. Rebase rewrites history by replaying commits on top of the target, creating a linear history. Use merge for public branches; use rebase locally before opening a pull request.
Git reset moves the HEAD pointer to a specified commit, optionally updating the index and working directory. Git revert creates a new commit that undoes the changes made by a previous commit.
Git stash is used to temporarily save changes that you have made to your working directory but have not yet committed. This allows you to switch branches or perform other operations without losing your work.
Git fetch downloads changes from a remote repository but does not merge them into your current branch. Git pull downloads changes and merges them into your current branch.

Quick reference

Git Cheat Sheet
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.