informatica:git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
informatica:git [2019/12/30 19:03] – [Subir un cambio] jose | informatica:git [2024/10/17 14:56] (current) – jose | ||
---|---|---|---|
Line 49: | Line 49: | ||
git checkout -b test | git checkout -b test | ||
git push origin test | git push origin test | ||
+ | Listar ramas: | ||
+ | < | ||
+ | git branch -a | ||
+ | master | ||
+ | * test | ||
+ | remotes/ | ||
+ | remotes/ | ||
+ | remotes/ | ||
+ | </ | ||
+ | Cambiar de rama: | ||
+ | < | ||
+ | git checkout master | ||
+ | A Dockerfile_ok | ||
+ | A Dockerfile_test | ||
+ | Switched to branch ' | ||
+ | Your branch is up to date with ' | ||
+ | </ | ||
===== Servidor git acceso claves ssh ===== | ===== Servidor git acceso claves ssh ===== | ||
Line 99: | Line 116: | ||
cat / | cat / | ||
</ | </ | ||
+ | |||
+ | ===== Volver a un commit previo ===== | ||
+ | |||
+ | Escenario: | ||
+ | |||
+ | * Queremos volver a un commit previo | ||
+ | * Queremos hacer un nuevo commit indicando "se ha vuelto al commit XXXX" | ||
+ | |||
+ | 1. Identificar el commit ID al que queremos volver: | ||
+ | |||
+ | git log | ||
+ | |||
+ | En este ejemplo: | ||
+ | |||
+ | commit c501b1d989d780ab17412fc646b62bfe24aa24d5 (tag: v0.10.0) | ||
+ | |||
+ | 2. Volver a ese commit en la copia local: | ||
+ | |||
+ | git reset --hard c501b1d989d780ab17412fc646b62bfe24aa24d5 | ||
+ | |||
+ | 3. **TODO**: clarificar qué hace exactamente este paso | ||
+ | |||
+ | git reset --soft HEAD@{1} | ||
+ | |||
+ | 4. Hacer un nuevo commit | ||
+ | |||
+ | git commit -m " | ||
+ | |||
+ | 5. Subir los cambios al repositorio remoto | ||
+ | |||
+ | git push | ||
===== Comandos sueltos ===== | ===== Comandos sueltos ===== | ||
Line 190: | Line 238: | ||
git push -u origin master | git push -u origin master | ||
</ | </ | ||
+ | |||
+ | ====== Deshacer un commit manteniendo cambios en local ====== | ||
+ | Si hacemos un commit antes de un pull y en el servidor hay cambios pero nuestro commit no afecta a esos cambios, para evitar conflictos, deshacemos el commit pero manteniendo los cambios en local: | ||
+ | git reset --soft HEAD^ | ||
+ | |||
informatica/git.1577732583.txt.gz · Last modified: 2019/12/30 19:03 by jose