Tool Library
Developer Tools

Git Cheatsheet

Fast commands for everyday Git workflows.

Git Cheatsheet

Setup

  • git init
  • git clone <url>

Config

  • git config --global user.name "Your Name"
  • git config --global user.email "you@example.com"
  • git config --global init.defaultBranch main

Branching

  • git branch
  • git switch -c feature/new-tool
  • git merge feature/new-tool
  • git branch -d feature/new-tool

Commit

  • git status
  • git add .
  • git commit -m "feat: add tool"

Undo

  • git restore <file>
  • git restore --staged <file>
  • git commit --amend
  • git reset --soft HEAD~1

Remote

  • git remote -v
  • git remote add origin <url>
  • git push -u origin main
  • git pull --rebase

Stash

  • git stash
  • git stash list
  • git stash apply
  • git stash drop

Log

  • git log --oneline --decorate --graph --all
  • git show <commit>