Skip to content

Cheat Sheet de Git

Última verificación mayo 2026 — corre en tu navegador
Cheatsheet de Git
git init

Initialize a new git repository

Configuración
git clone <url>

Clone a remote repository

Configuración
git config --global user.name "Name"

Set your global username

Configuración
git config --global user.email "email"

Set your global email

Configuración
git config --list

Show all configuration settings

Configuración
git remote add origin <url>

Add a remote repository

Configuración
git remote -v

List remote repositories

Configuración
git branch

List local branches

Ramas
git branch -a

List all branches (local + remote)

Ramas
git branch <name>

Create a new branch

Ramas
git branch -d <name>

Delete a branch (safe)

Ramas
git branch -D <name>

Force delete a branch

Ramas
git branch -m <old> <new>

Rename a branch

Ramas
git checkout <branch>

Switch to a branch

Ramas
git checkout -b <name>

Create and switch to new branch

Ramas
git switch <branch>

Switch to a branch (modern)

Ramas
git switch -c <name>

Create and switch (modern)

Ramas
git status

Show working tree status

Commits
git add <file>

Stage a specific file

Commits
git add .

Stage all changes

Commits
git add -p

Stage changes interactively (by hunk)

Commits
git commit -m "message"

Commit staged changes with message

Commits
git commit -am "message"

Stage tracked files and commit

Commits
git commit --amend

Amend the last commit

Commits
git diff

Show unstaged changes

Commits
git diff --staged

Show staged changes

Commits
git diff <branch1> <branch2>

Compare two branches

Commits
git push

Push commits to remote

Remoto
git push -u origin <branch>

Push and set upstream branch

Remoto
git push --force

Force push (destructive!)

Remoto
git pull

Fetch and merge remote changes

Remoto
git pull --rebase

Fetch and rebase instead of merge

Remoto
git fetch

Download remote changes without merging

Remoto
git fetch --prune

Fetch and remove deleted remote branches

Remoto
git push origin --delete <branch>

Delete a remote branch

Remoto
git stash

Stash current changes

Stash
git stash push -m "message"

Stash with a description

Stash
git stash list

List all stashes

Stash
git stash pop

Apply and remove latest stash

Stash
git stash apply

Apply latest stash without removing

Stash
git stash drop

Delete latest stash

Stash
git stash clear

Delete all stashes

Stash
git log

Show commit history

Historial
git log --oneline

Show compact commit history

Historial
git log --graph --oneline

Show commit graph

Historial
git log -n 5

Show last 5 commits

Historial
git log --author="name"

Filter commits by author

Historial
git log -- <file>

Show commits for a specific file

Historial
git blame <file>

Show who changed each line

Historial
git show <commit>

Show details of a commit

Historial
git merge <branch>

Merge a branch into current

Fusión
git merge --no-ff <branch>

Merge with a merge commit (no fast-forward)

Fusión
git merge --abort

Abort a merge in progress

Fusión
git rebase <branch>

Rebase current branch onto another

Fusión
git rebase --abort

Abort a rebase in progress

Fusión
git cherry-pick <commit>

Apply a specific commit to current branch

Fusión
git restore <file>

Discard changes in working directory

Deshacer
git restore --staged <file>

Unstage a file

Deshacer
git reset HEAD~1

Undo last commit, keep changes staged

Deshacer
git reset --hard HEAD~1

Undo last commit and discard changes

Deshacer
git revert <commit>

Create a new commit that undoes a commit

Deshacer
git clean -fd

Remove untracked files and directories

Deshacer
git reflog

Show history of HEAD changes (recovery)

Deshacer
git tag

List all tags

Etiquetas
git tag <name>

Create a lightweight tag

Etiquetas
git tag -a <name> -m "msg"

Create an annotated tag

Etiquetas
git push --tags

Push all tags to remote

Etiquetas
git tag -d <name>

Delete a local tag

Etiquetas
Mostrando 68 de 68 comandos

Cheatsheet de comandos Git

Una referencia completa y buscable de los comandos git más útiles. Filtra por categoría (configuración, ramas, commits, remoto, stash, historial, fusión, deshacer, etiquetas) o busca por palabra clave. Copia cualquier comando con un clic.

Sobre este cheatsheet

Este cheatsheet de Git cubre las operaciones más comunes organizadas por categoría de flujo de trabajo. Perfecto como referencia rápida mientras programas.

  • Más de 65 comandos git con descripciones
  • Filtrar por categoría (Configuración, Ramas, Commits, Remoto, Stash, Historial, Fusión, Deshacer, Etiquetas)
  • Búsqueda de texto completo en comandos y descripciones
  • Copia al portapapeles con un clic
  • Funciona sin conexión: todos los datos están en la página

Gratis. Sin registro. Tus datos permanecen en tu navegador. Anuncios mediante Google AdSense (con consentimiento).

Por ·