Publicaciones
Hoja de trucos de Git
1 de octubre de 2014 • 2 min de lectura
A continuación se muestran los comandos de git que uso una y otra vez.
Clonar repositorio
git clone https://github.com/tinymce/tinymce-dist.git
Agregar archivos git existentes a repositorio git remoto
cd /path/to/my/repo
git remote add origin https://lostinkali@bitbucket.org/lostinkali/flightstats.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
Crear un repositorio en carpeta existente
git init
git add .
# Adds the files in the local repository and stages them for commit
git commit -m "Initial commit"
Cambiar rama actual a master
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch
Eliminar rama
git branch -D bugfix
Revertir a commit anterior
git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master
Agrega el archivo a git.
git add [filename]
Elimina los archivos sin seguimiento desde el commit más reciente en el registro.
git clean -fd
Confirma los archivos agregados a git.
git commit -m "enter message here"
Elimina el archivo de git. Usa -f para forzar la eliminación del archivo incluso cuando hay cambios.
git rm file1.txt
Etiquetar un punto específico en el tiempo.
git tag -a v1.4 -m 'my version 1.4' Autor: Chuck Conway es un Ingeniero de IA con casi 30 años de experiencia en ingeniería de software. Construye sistemas de IA prácticos—canalizaciones de contenido, agentes de infraestructura y herramientas que resuelven problemas reales—y comparte lo que está aprendiendo en el camino. Conéctate con él en redes sociales: X (@chuckconway) o visítalo en YouTube y en SubStack.