Skip to content

Repositorio personal con un resumen práctico de comandos y buenas prácticas de Git, enfocado en el uso diario con GitHub y GitLab, manejo de identidades (personal y corporativa), SSH, VS Code y control de versiones seguro para proyectos técnicos.

Notifications You must be signed in to change notification settings

jaanvagu/git-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Git Cheatsheet – Uso diario (macOS · GitHub · GitLab · VS Code)

Cheatsheet de comandos Git y atajos para trabajar desde macOS, usando GitHub (personal) y GitLab (corporativo), principalmente desde VS Code y terminal.


🔧 Verificación básica

git --version
which git
git status

📁 Inicializar un repositorio nuevo

git init
git branch -M main

Primer commit:

git add .
git commit -m "Primer commit"

🌐 Conectar con repositorio remoto

GitHub (personal)

git remote add origin git@github.com:USUARIO/REPO.git
git push -u origin main

GitLab (corporativo)

git remote add origin git@gitlab.com:GRUPO/SUBGRUPO/REPO.git
git push -u origin main

🔄 Cambiar remoto existente

git remote rename origin old-origin
git remote add origin NUEVA_URL

Ver remotos:

git remote -v

🧑‍💻 Identidad Git por repositorio

git config user.name "Jairo Valencia"
git config user.email "correo@dominio.com"

Ver configuración activa:

git config --list

🔑 Probar conexión SSH

ssh -T git@github.com
ssh -T git@gitlab.com

📌 Flujo diario básico

git status
git add .
git commit -m "Mensaje del commit"
git push

🧩 Stage (staging area)

Agregar archivo específico:

git add archivo.py

Quitar del stage:

git restore --staged archivo.py

🧹 Aplicar .gitignore cuando ya había archivos trackeados

git rm -r --cached .
git add .
git commit -m "Aplicar .gitignore"

🌿 Ramas

Listar ramas:

git branch

Crear y cambiar:

git checkout -b nueva-rama

Volver a main:

git checkout main

Merge:

git merge nueva-rama

📜 Historial

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

🧠 Diagnóstico rápido

git diff
git diff --staged
git status -sb

🧪 Clonar repositorios

git clone git@github.com:USUARIO/REPO.git
git clone git@gitlab.com:GRUPO/REPO.git

🧰 VS Code (macOS)

  • Control de versiones:

    ⌘ + Shift + G
    
  • Terminal integrada:

    Ctrl + `
    
  • Commit desde VS Code:

    • Escribir mensaje
    • ✔ Commit
    • Push desde la barra inferior

🛡️ Cheatsheet operativo para trabajo diario en seguridad, compliance y desarrollo.

About

Repositorio personal con un resumen práctico de comandos y buenas prácticas de Git, enfocado en el uso diario con GitHub y GitLab, manejo de identidades (personal y corporativa), SSH, VS Code y control de versiones seguro para proyectos técnicos.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages