Skip to main content
DeveloperFree · 3 uses/dayProcessed in your browser

Git Commands (Quick Guide)

Interactive visual guide to the essential Git commands.

Track
4 scenarios
Commands
24
Caution
1 high
Recovery
Assisted
01

Filter by scenario

Search track
Presets

Start repository

Create repo, prepare base branch, and connect remote without friction.
git initlow
Initializes the repository in the current folder.
git add .low
Moves initial files to staging.
git commit -m "chore: init"low
Creates the first baseline commit.
git branch -M mainlow
Standardizes the main branch before push.
git remote add origin <url>low
Connects the main remote repository.
git remote add origin https://github.com/org/repo.git
git push -u origin mainlow
Publishes the base branch and sets upstream.

Feature flow

Open working branch, update base, and integrate back with clarity.
git switch -c feature/<tema>low
Creates and switches to the feature branch.
git switch -c feature/login
git add .low
Updates staging with current progress.
git commit -m "feat: ..."low
Records a work step with context.
git fetch originlow
Updates remote references before integration.
git switch mainlow
Returns to the integration base.
git merge feature/<tema>medium
Integrates the feature branch into the base.

Safe undo

Choose between restore, reset, and revert without accidentally destroying work.
git restore <arquivo>medium
Discards uncommitted local change in a file.
git restore src/app/page.tsx
git restore --staged <arquivo>low
Removes file from staging without losing local edit.
git reset --soft HEAD~1medium
Goes back one commit keeping everything in staging.
git reset --mixed HEAD~1medium
Goes back one commit and returns changes to working tree.
git revert <hash>low
Creates a safe inverse commit for shared history.

Shelve work in progress

Get the dirty work out of the way to switch branches, then bring it back.
git stash push -m "<motivo>"low
Shelves uncommitted changes with a label.
git stash push -m "meio da tela de login"
git stash push -ulow
Also includes files that are not tracked yet.
git stash listlow
Lists what is shelved, newest first.
git stash show -p stash@{0}low
Shows the stash diff before applying it.
git stash popmedium
Brings the newest stash back and removes it from the stack.
git stash apply stash@{1}medium
Applies a specific stash and KEEPS it on the stack.
git stash drop stash@{0}high
Drops a stash — there is no undo after this.
02

Quick decision

Undo
Use restore for local files, revert for shared history, and reflog before aggressive reset.
Integration
Prefer merge when you want to preserve branching and rebase when you want to linearize before final merge.
Scale
Use worktree for parallel branches and sparse-checkout when the monorepo is too large for the current task.
03

Export

Recovery and selective delivery
Rebase with exit route, reflog for rescue, and cherry-pick for hotfix or backport without full merge.
Exportable runbook
Export the filtered track to CSV for technical inventory or TXT for shareable squad playbook.
04

Operational view

Attention
Low
17
Medium
6
High
1
Placeholders like <tema>, <arquivo>, <hash>, and <url> must be replaced before execution.

Related

More in this category

Da mesma categoria.