Comandos útiles de git
# git log mejorada. Ponerlo en .gitconfig
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
# Excluir ficheros del sistema git
nano .git/info/exclude # añadir ruta del fichero
# Extraer un commit o varios commits de una rama e incluirlos en otra
git cherry-pick [SHA del commit de otra rama]
git cherry-pick --abort # si algo malo pasa
# Eliminar un commit de una rama
git rebase -i [sha del commit anterior al commit que queremos rebasar]
# Crear release.
git checkout develop
git pull origin develop
git checkout -b release/8.8.8
# Crear tag
git tag -a 8.8.8 -m "Crear tag 8.8.8"
# Mostrar diferencias de los cambios en estado staged
git diff --staged
# Añadir globalmente nombre y email
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "FIRST_NAME LAST_NAME"
# guardar contraseña
git config credential.helper store