linux:sistemaoperativo:git
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| linux:sistemaoperativo:git [2019/02/04 12:44] – grillo | linux:sistemaoperativo:git [2019/02/12 11:52] (actual) – grillo | ||
|---|---|---|---|
| Línea 2: | Línea 2: | ||
| ========== | ========== | ||
| - | clonar separando código y .git en distintos directorios | + | clonar separando código y .git en distintos directorios |
| ``` | ``` | ||
| $ git clone --separate-git-dir / | $ git clone --separate-git-dir / | ||
| Línea 23: | Línea 23: | ||
| clonar contra https con certificado erroneo | clonar contra https con certificado erroneo | ||
| - | ``` | + | ``` |
| GIT_SSL_NO_VERIFY=true git clone https:// | GIT_SSL_NO_VERIFY=true git clone https:// | ||
| git config http.sslVerify " | git config http.sslVerify " | ||
| Línea 39: | Línea 39: | ||
| ver ramas locales | ver ramas locales | ||
| - | ``` | + | ``` |
| $ git branch | $ git branch | ||
| ``` | ``` | ||
| comparar repositorio local con el origin | comparar repositorio local con el origin | ||
| - | ``` | + | ``` |
| git remote show origin | git remote show origin | ||
| ``` | ``` | ||
| agregar archivos nuevos al área de trabajo para commit | agregar archivos nuevos al área de trabajo para commit | ||
| - | ``` | + | ``` |
| git add . | git add . | ||
| ``` | ``` | ||
| ver cambios que se grabarán en el próximo commit | ver cambios que se grabarán en el próximo commit | ||
| - | ``` | + | ``` |
| git status | git status | ||
| ``` | ``` | ||
| commit con mensaje | commit con mensaje | ||
| - | ``` | + | ``` |
| git commit -a -m ' | git commit -a -m ' | ||
| ``` | ``` | ||
| agregar archivo olvidado al último commit | agregar archivo olvidado al último commit | ||
| - | ``` | + | ``` |
| git commit --amend | git commit --amend | ||
| ``` | ``` | ||
| ver historial de commits | ver historial de commits | ||
| - | ``` | + | ``` |
| git log --stat | git log --stat | ||
| ``` | ``` | ||
| ver historial de commits abreviado | ver historial de commits abreviado | ||
| - | ``` | + | ``` |
| git log --pretty=oneline | git log --pretty=oneline | ||
| ``` | ``` | ||
| ver diferencias entre último commit y el anterior | ver diferencias entre último commit y el anterior | ||
| - | ``` | + | ``` |
| git log -p -2 | git log -p -2 | ||
| ``` | ``` | ||
| ver árbol de versionados | ver árbol de versionados | ||
| - | ``` | + | ``` |
| git log --pretty=format:" | git log --pretty=format:" | ||
| ``` | ``` | ||
| volver a un commit anterior | volver a un commit anterior | ||
| - | ``` | + | ``` |
| git revert 0d1d7fc32 | git revert 0d1d7fc32 | ||
| ``` | ``` | ||
| anular últimos commits perdiendo cambios | anular últimos commits perdiendo cambios | ||
| - | ``` | + | ``` |
| git reset --hard 0d1d7fc32 | git reset --hard 0d1d7fc32 | ||
| ``` | ``` | ||
| crear nueva rama (igual al commit actual) | crear nueva rama (igual al commit actual) | ||
| - | ``` | + | ``` |
| git branch testing | git branch testing | ||
| ``` | ``` | ||
| borrar rama local | borrar rama local | ||
| - | ``` | + | ``` |
| git branch -d the_local_branch | git branch -d the_local_branch | ||
| ``` | ``` | ||
| Línea 112: | Línea 112: | ||
| ``` | ``` | ||
| - | aplicar en master | + | aplicar en master |
| - | ``` | + | ``` |
| git checkout master | git checkout master | ||
| git merge test | git merge test | ||
| Línea 119: | Línea 119: | ||
| limpiar entorno sucio por cambios no aplicados: 1-ver 2-aplicar | limpiar entorno sucio por cambios no aplicados: 1-ver 2-aplicar | ||
| - | ``` | + | ``` |
| git clean -n | git clean -n | ||
| - | ``` | ||
| git clean -f | git clean -f | ||
| ``` | ``` | ||
| Línea 127: | Línea 126: | ||
| revertir un archivo a un estado varios commits anterior | revertir un archivo a un estado varios commits anterior | ||
| ver contenido del archivo en el commit | ver contenido del archivo en el commit | ||
| - | ``` | + | ``` |
| git show a4r9593432: | git show a4r9593432: | ||
| ``` | ``` | ||
| Línea 136: | Línea 135: | ||
| ``` | ``` | ||
| revisar las diferencias | revisar las diferencias | ||
| - | ``` | + | ``` |
| git diff --cached path/ | git diff --cached path/ | ||
| ``` | ``` | ||
| aplicar el cambio | aplicar el cambio | ||
| - | ``` | + | ``` |
| git commit | git commit | ||
| ``` | ``` | ||
| Línea 150: | Línea 149: | ||
| ver diferencias entre version actual y 2 versiones anteriores de un archivo | ver diferencias entre version actual y 2 versiones anteriores de un archivo | ||
| - | ``` | + | ``` |
| git diff HEAD@{2} / | git diff HEAD@{2} / | ||
| ``` | ``` | ||
| crear tag | crear tag | ||
| - | ``` | + | ``` |
| git tag -a v1.4 -m "my version 1.4" | git tag -a v1.4 -m "my version 1.4" | ||
| ``` | ``` | ||
| + | |||
| crear tag desde commit | crear tag desde commit | ||
| - | ``` | + | ``` |
| git tag -a v1.2 0b7434d86859cc7b8c3d5e1dddfed66ff742fcbc | git tag -a v1.2 0b7434d86859cc7b8c3d5e1dddfed66ff742fcbc | ||
| ``` | ``` | ||
| crear tag liviano (solo info del commit) | crear tag liviano (solo info del commit) | ||
| - | ``` | + | ``` |
| git tag v1.4 | git tag v1.4 | ||
| ``` | ``` | ||
| Línea 242: | Línea 242: | ||
| Mensaje con servidor y repositorio | Mensaje con servidor y repositorio | ||
| - | ``` | + | ``` |
| $ git config hooks.showrev "t=%s; printf ' | $ git config hooks.showrev "t=%s; printf ' | ||
| ``` | ``` | ||
| Línea 271: | Línea 271: | ||
| 1) | 1) | ||
| Clonar repositorio | Clonar repositorio | ||
| - | ``` | + | ``` |
| git clone ssh:// | git clone ssh:// | ||
| cd debian7base | cd debian7base | ||
| Línea 289: | Línea 289: | ||
| Agregar archivos nuevos al indice | Agregar archivos nuevos al indice | ||
| - | ``` | + | ``` |
| git add . | git add . | ||
| ``` | ``` | ||
| Modificar archivos existentes | Modificar archivos existentes | ||
| - | ``` | + | ``` |
| vim README | vim README | ||
| ``` | ``` | ||
linux/sistemaoperativo/git.1549284286.txt.gz · Última modificación: 2019/02/04 12:44 por grillo