Skip to content

Instantly share code, notes, and snippets.

@sequielo
Created September 11, 2012 03:03
Show Gist options
  • Save sequielo/3695636 to your computer and use it in GitHub Desktop.
Save sequielo/3695636 to your computer and use it in GitHub Desktop.
My git cheatsheet

GIT

Doc

Comun

git branch obtiene branch actual git status obtiene archivos sin commit git blame obtiene quien fue el ultimo autor en escribir cada linea git log --author= obtiene el historial de commits de regex

Colorear

git config --global --add color.ui true

Subir al Repo

git pull git add <file1..fileN> git commit [-a] -m "comment" git push

Actualizar borrados y movidos

git add -u git commit

Bajar un branch y actualizarlo con el local

git checkout -b <nombre_branch_local> -t origin/<nombre_branch_remoto> baja el branch remoto git merge <otro_branch_previo> mergea el otro branch local con el nuevo git push

Crear un branch local enganchado con uno remoto

git checkout -b <nombre_branch> git push -u origin <nombre_branch>

Crear un branch local basado en un commit anterior

git branch

Mergear otro en actual

git checkout git pull git checkout git merge git push

Undo un commit (no pusheado)

(git commit -m "aaaa")

git reset --soft HEAD^ git reset (editar archivos) git add . git commit -m "new msg"

Undo un commit ya pusheado a remoto

git reset --soft HEAD^ git reset git stash git push -f origin <last_known_good_commit_sha_id>:<branch_name> git stash pop

Rama divergida

(backupear archivos) git reset --hard origin/ ## Borra todo los commits locales hasta el ultimo remote/origin/branch

remover un branch remoto

git branch -rd git push origin : git remote prune origin (opcional, limpia los branches staled)

Traer un branch remoto

git checkout -b <nombre_local> -t origin/<nombre_remoto>

Mostrar todos los branch

git branch #muestra branch locales y actual git branch -r #muestra branch remotos git remote show origin #muestra info de todos los branches

Cambiar ultimo commit no pusheado

git commit --amend -m "new message"

git commit --amend --author="Author Name email@address.com" git commit --amend --reset-author

git commit -c ORIG_HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment