NexTool
ToolsConvertersBlogAI SuitePricing
HomeCheat SheetsGit Commands Quick Reference Cheat Sheet
developer4 sections · 25 items

Git Commands Quick Reference Cheat Sheet

Essential git commands organized by workflow: setup, daily use, branching, undoing changes, and collaboration.

Setup & Config

ItemValueNotes
Set usernamegit config --global user.name "Name"--
Set emailgit config --global user.email "email@example.com"--
Init new repogit init--
Clone repogit clone <url>Add --depth 1 for shallow clone
View configgit config --list--

Daily Workflow

ItemValueNotes
Check statusgit statusAdd -s for short format
Stage filesgit add <file> or git add .. stages all changes
Commitgit commit -m "message"Use -am to stage+commit tracked files
View loggit log --oneline --graphCompact visual history
View diffgit diff--staged for staged changes
Pull latestgit pull origin mainAdd --rebase to avoid merge commits
Push changesgit push origin <branch>--

Branching & Merging

ItemValueNotes
Create branchgit branch <name>--
Switch branchgit checkout <name> or git switch <name>--
Create + switchgit checkout -b <name>Or git switch -c <name>
List branchesgit branch -a-a includes remote branches
Merge branchgit merge <branch>From the target branch
Delete branchgit branch -d <name>-D to force delete
Rebasegit rebase <branch>Replays commits on top

Undoing Changes

ItemValueNotes
Unstage filegit restore --staged <file>--
Discard changesgit restore <file>Cannot be undone
Amend last commitgit commit --amendChanges the commit hash
Revert a commitgit revert <hash>Creates a new undo commit
Reset to commitgit reset --hard <hash>Destroys uncommitted work
Stash changesgit stashgit stash pop to restore

Tip: Use landscape orientation for wider tables

Related Tools

Text Diff Checker

Compare two texts and find differences

Markdown Preview

Write and preview Markdown in real-time

Slug Generator

Convert text to URL-friendly slugs

JSON Formatter

Format, validate, and beautify JSON data

Stay Updated

Get notified about new tools, features, and exclusive deals. No spam, ever.

Browse All Cheat Sheets →
NexTool

Free online tools for developers, writers, and creators. Powered by AI.

Tools

  • Finance & Tax
  • Investment & Retirement
  • Insurance
  • Real Estate
  • Health & Fitness
  • Home & DIY
  • Developer Tools
  • AI Tools
  • All Tools

Resources

  • Blog
  • Unit Conversions
  • All Tools

Company

  • About
  • Pricing
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2026 NexTool. All rights reserved.

Fine Print Decoder™ and all AI analysis tools are proprietary technology of NexTool.

Made with care for the internet