VOLVER
REFERENCIA RÁPIDA

GIT CHEATSHEET

TODOS LOS COMANDOS QUE NECESITAS, EN UN SOLO LUGAR.

CONFIGURACIÓN

  • git config --global user.name "Tu Nombre"

    Configura tu nombre

  • git config --global user.email "[email protected]"

    Configura tu email

  • git config --global credential.helper osxkeychain

    Guarda credenciales · macOS

  • git config --global credential.helper manager-core

    Guarda credenciales · Windows

  • git config --global credential.helper 'cache --timeout=3600'

    Guarda credenciales · Linux

  • git config --list

    Ver toda la configuración

EMPEZAR

  • git init

    Inicia un repo nuevo

  • git clone <url>

    Clona un repo remoto

  • git remote add origin <url>

    Conecta repo local a remoto

  • git remote -v

    Ver remotos configurados

DÍA A DÍA

  • git status

    Ver estado de archivos

  • git add <archivo>

    Agrega archivo al staging

  • git add .

    Agrega todos los cambios

  • git commit -m "mensaje"

    Crea un commit

  • git push

    Sube cambios al remoto

  • git pull

    Baja cambios del remoto

  • git fetch

    Baja sin mergear

RAMAS

  • git branch

    Lista ramas

  • git switch -c feature/x

    Crea y cambia a rama

  • git switch main

    Cambia a rama main

  • git merge feature/x

    Mergea rama a la actual

  • git branch -d feature/x

    Borra rama local

  • git push origin --delete feature/x

    Borra rama remota

HISTORIAL

  • git log

    Historial de commits

  • git log --oneline --graph --all

    Historial visual

  • git diff

    Ver cambios sin add

  • git diff --staged

    Ver cambios staged

  • git show <hash>

    Ver detalle de un commit

DESHACER

  • git restore <archivo>

    Descarta cambios sin add

  • git restore --staged <archivo>

    Saca del staging

  • git reset --soft HEAD~1

    Deshace último commit (mantiene cambios)

  • git reset --hard HEAD~1

    Deshace commit Y CAMBIOS ⚠️

  • git revert <hash>

    Crea commit que deshace otro

STASH

  • git stash

    Guarda cambios temporales

  • git stash list

    Lista stashes

  • git stash pop

    Recupera el último stash

  • git stash push -m "msg"

    Stash con mensaje

AVANZADO

  • git rebase main

    Rebase sobre main

  • git rebase -i HEAD~3

    Rebase interactivo

  • git cherry-pick <hash>

    Aplica un commit específico

  • git tag v1.0.0

    Crea un tag

  • git reflog

    Historial de TODO (rescate)