** Basic: Init git and upload files **
git init # Inicializar
git add . # Añadir archivos
git status # Estado
git commit . -m "Mi comentario"
git remote add origin https://github.com/user/repo.git # Definir repositorio
git push origin master
** Change commet of push **
*** http://es.stackoverflow.com/questions/3165/como-edito-un-mensaje-incorrecto-en-un-push-de-git ***
git commit --amend -m "nuevo mensaje"
git push --force
** Lists all files for the last commit (HEAD) **
git show --name-only --oneline HEAD
** Delete a remote git tag **
git tag -d v1.0.0
git push origin :refs/tags/v1.0.0
** Fetch remote git tags only **
git fetch --tags
** Push remote git tags only **
git push origin --tags
** Create remote name (for example: origin) **
git remote add origin http://github.com/repo.git
** Show the last commit **
git log --name-status HEAD^..HEAD
** Show the last commit hash in short version **
git rev-parse --short HEAD
** Delete the last commit from HEAD **
git reset --hard HEAD~1
** Update remote origin URL **
*** https://help.github.com/articles/changing-a-remote-s-url/ ***
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
** Change local user in git **
*** http://campus.ktaris.com/modificar-usuario-local-de-git/ ***
# Primero, elimina el usuario actual (nombre y correo).
git config --global --unset-all user.name
git config --global --unset-all user.email
# Luego, vuelve a configurar las propiedades con tus datos.
git config --global --add user.name "El nuevo usuario"
git config --global --add user.email "[email protected]"
** Switching remote URLs **
# Visualizar las rutas actuales
git remote -v
# Actualizar ruta
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
# Verificar
git remote -v
** Create branch **
git checkout -b nameBranch
** Go to branch **
git checkout nameBranch
** List branchs **
git branch