User Tools

Site Tools


informatica:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatica:git [2019/12/30 19:03] – [Subir un cambio] joseinformatica:git [2022/01/06 20:19] (current) jose
Line 49: Line 49:
   git checkout -b test   git checkout -b test
   git push origin test   git push origin test
 +Listar ramas:
 +<code>
 +git branch -a
 +  master
 +* test
 +  remotes/origin/HEAD -> origin/master
 +  remotes/origin/master
 +  remotes/origin/test
 +</code>
 +Cambiar de rama:
 +<code>
 +git checkout master
 +A Dockerfile_ok
 +A Dockerfile_test
 +Switched to branch 'master'
 +Your branch is up to date with 'origin/master'.
 +</code>
  
 ===== Servidor git acceso claves ssh ===== ===== Servidor git acceso claves ssh =====
Line 99: Line 116:
 cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
 </code> </code>
 +
 +===== 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 "Reverting to the state of the project at c501b1d989d780ab17412fc646b62bfe24aa24d5"
 +
 +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
 </code> </code>
 +
 +====== Borrar un fichero ======
  
  
  
informatica/git.txt · Last modified: 2022/01/06 20:19 by jose