Folha de Dicas de Comandos Git
Referência interativa de mais de 80 comandos Git essenciais, organizados por categoria com pesquisa e favoritos.
Sobre esta ferramenta
Uma referência Git interativa cobrindo mais de 80 comandos de uso comum organizados em categorias: Configuração, Fluxo de Trabalho Básico, Ramificação, Remoto, Desfazer, Stash, Log/Histórico e Avançado. Pesquise comandos por palavra-chave, marque favoritos para acesso rápido e clique em qualquer comando para copiá-lo ou ver uma explicação detalhada.
Como usar
- 1 Passo 1: Navegue pelos comandos por categoria usando a navegação de abas, ou use a caixa de pesquisa para encontrar um comando específico.
- 2 Passo 2: Clique no botão de cópia ao lado de qualquer comando para copiá-lo diretamente para sua área de transferência.
- 3 Passo 3: Clique no ícone de estrela para marcar comandos como favoritos — eles serão salvos e acessíveis pela aba Favoritos.
- 4 Passo 4: Ative o modo 'Explicar' e clique em qualquer comando para ver uma explicação detalhada com exemplos e casos de uso.
A searchable reference for the commands you keep forgetting
Git has hundreds of commands and flags, but most daily work draws on a few dozen. The trouble is remembering the exact syntax under pressure — the difference between reset --soft and reset --hard, or how to safely undo a push. This cheat sheet collects the commands that matter, organised into the categories you actually think in: Setup, Basic Workflow, Branching, Remote, Undo, Stash, Log/History, and Advanced. Each entry shows the command, a one-line description, and a real example you can copy with a single click.
How to use it: tabs, search, and Explain mode
Three controls make this faster than scrolling a long list. Category tabs jump straight to a group — click "Branching" to see only branch commands. Search matches across both command text and descriptions at once, so typing undo surfaces relevant commands even though the word "undo" is in the description, not the command. And Explain mode is the key feature: tick it, then click any command to expand a paragraph describing what it really does, with its own worked example. That turns the sheet from a list of strings into something that teaches the why, not just the what.
Favorites that persist
Every command has a star. Click it and the command is added to a Favorites tab, and that list is saved in your browser's local storage — so the handful of commands you reach for daily are still there the next time you open the page. There is no account and no sync; the favorites live on your device. The Copy button next to each command puts just the command text on your clipboard and flashes a brief "Copied!" confirmation.
A worked example: undoing your last commit
Suppose you committed too early. Open the Undo tab and you will see three resets that look almost identical but behave very differently — this is exactly where people get burned:
| Command | Moves HEAD back? | Your changes |
|---|---|---|
git reset --soft HEAD~1 | Yes | Kept, still staged |
git reset --mixed HEAD~1 | Yes | Kept, unstaged |
git reset --hard HEAD~1 | Yes | Discarded permanently |
Turn on Explain mode and click git reset --hard HEAD~1: it warns that the change "cannot be undone easily." For undoing a commit you have already pushed, the sheet points you instead to git revert, which creates a new commit that reverses the old one — safe for shared branches because it rewrites no history.
The safety distinctions worth internalising
--forceversus--force-with-lease. A plain force push can clobber a teammate's work.git push --force-with-leaseonly succeeds if nobody has pushed since your last fetch — the sheet recommends it for exactly this reason.- Reset versus revert. Reset moves history and is fine on local, unpushed commits; revert adds an undo commit and is the right tool once others have your commits.
- Merge versus rebase. Merge preserves the branch shape with a merge commit; rebase replays your commits for a linear history. The sheet lists both with notes on when each fits.
git reflogis your safety net. If a reset loses a commit, reflog shows where HEAD pointed recently so you can recover it — one of the most reassuring commands to know exists.
Beyond the basics
The Advanced tab covers the commands that feel like magic once you meet them: git cherry-pick to lift a single commit onto another branch, git rebase -i to squash and reorder commits before a merge, git bisect to binary-search history for the commit that introduced a bug, and git worktree to check out two branches in two folders at once. The Stash tab covers saving half-finished work out of the way, and Log/History covers reading the past — git log --oneline --graph --all for a visual branch map, git blame to find who last touched a line.
Common mistakes this sheet helps you avoid
- Reaching for
--hardwhen you meant--soft. Read the Explain text before running a reset you cannot undo. - Using
commit -amand expecting new files to be included. The note makes clear it only stages already-tracked files, not new untracked ones. - Amending or force-pushing shared branches. The entries flag which commands rewrite history and should stay on your local work.
Everything runs in your browser. There is no Git execution here and nothing is sent anywhere — it is a fast, private, copy-ready reference that remembers your favorites between visits.