This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hacer stash de todos los archivos, nuevos o modificados | |
git stash save --include-untracked "nombre del stash" | |
# Hacer stash de todos los archivos, nuevos o modificados MAS corto | |
git stash -u | |
# Retomar los cambios del ultimo stash guardado | |
git stash pop | |
# Hacer un hard reset de una branch | |
git reset --hard origin/branch_name | |
# Remover N commits de una branch | |
git reset --hard HEAD~5 # Ultimos 5 commits eliminados | |
# Deshacer N commits de una branch, pero dejar los cambios locales | |
git reset --soft HEAD~1 # Ultimo commit se convierte en cambios no commiteados | |
# Actualizar branch actual con fetch y pull en un solo | |
git fetch -p && git pull | |
# Agregar cambios staged al ultimo commit, edita el ultimo commit | |
git commit --amend --no-edit | |
# Agregar commit (usando el hash) a la actual branch | |
git cherry-pick ...HASH # 1 o > 1 hashes | |
# Agregar cambios (usndo el hash) a la actual branch, como cambios no commiteados | |
git cherry-pick -n ...HASH # 1 o > 1 hashes | |
# Ver los commits en una linea cada uno | |
git log --pretty=oneline --abbrev-commit | |
# Ver los commits con un log mas legible | |
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
# Obtener el hash del ultimo commit | |
git rev-parse --verify HEAD | |
# Usar git rebase interactive para eliminar commits dentro de la branch bien paja | |
git rebase -i HEAD~N # N es el numero de los ultimos de commits a evaluar | |
# Usar siempre nano para editar rebases, mensajes de git, y asi | |
git config --global core.editor "nano" | |
# Usar vscode como editor de git | |
git config --global core.editor "code --wait" | |
# Como solucionar el CRLF problem en Windows y Git, source: https://stackoverflow.com/questions/49228693/how-to-change-eol-for-all-files-from-clrf-to-lf-in-visual-studio-code | |
git config core.autocrlf false | |
git rm --cached -r . | |
git reset --hard | |
# Asumir que un archivo no ha sido cambiado | |
git update-index --assume-unchanged /path/to/file | |
# Exportar el historial de acciones de git a un archivo | |
git reflog > log.txt | |
# Resolver permisos para editar node_modules | |
npm config set unsafe-perm=true | |
# Como hacer aparecer el github prompt en go get | |
env GIT_TERMINAL_PROMPT=1 go get github.com/examplesite/myprivaterepo | |
# See all versions available of a npm package | |
npm view webpack versions --json | |
# See the lines changes for the current status | |
git diff --shortstat | |
# See the lines changes between 2 branches | |
git diff --shortstat branch_name | |
# When configuring for first time git, set user and email | |
git config --global user.name "LuisPa Garcia" | |
git config --global user.email diganluispa@gmail.com | |
# Set default git editor | |
git config --global core.editor nano | |
############################################# | |
######### GIT CONFIG ~/.gitconfig ########### | |
############################################# | |
[user] | |
name = LuisPa Garcia | |
email = diganluispa@gmail.com | |
[core] | |
editor = nano | |
[alias] | |
s = status | |
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
hash = rev-parse --verify HEAD | |
stash = stash -u | |
soft = reset --soft HEAD~1 | |
### ALIAS | |
alias up="git fetch -p && git pull" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment