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
Next revisionBoth sides next revision
informatica:git [2015/04/13 20:19] – external edit 127.0.0.1informatica:git [2019/12/30 19:07] – [Añadir rama branch] jose
Line 1: Line 1:
 ====== git ====== ====== git ======
 +
 +===== Tags =====
 +
 +1. Listar los commits de un repositorio
 +
 +<code>
 +git log --pretty=oneline
 +</code>
 +
 +2. Marcar con una etiqueta (en este ejemplo "v1.0") el commit deseado:
 +
 +<code>
 +git tag -a v1.0 947c168ba5cc2c40dabe15b1a140e0a90f29f3c3
 +</code>
 +
 +3. Subir las etiquetas al repositorio remoto:
 +
 +<code>
 +git push origin v1.0
 +</code>
  
 ===== Iniciar repositorio en remoto ===== ===== Iniciar repositorio en remoto =====
Line 19: Line 39:
 4. Move the directory to its final location using SSH 4. Move the directory to its final location using SSH
   scp -rv /tmp/manhattan_project.git user@git.example.com:/git/repositories/   scp -rv /tmp/manhattan_project.git user@git.example.com:/git/repositories/
 +  
 +===== Subir un cambio =====
 +
 +  git add <fichero>
 +  git commit -m "cambio realizado"
 +  git push
 +===== Añadir rama branch =====
 +  git pull
 +  git checkout -b 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 68: Line 115:
 sudo su git sudo su git
 cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
-<code> +</code>
  
 ===== Comandos sueltos ===== ===== Comandos sueltos =====
- 
  
 http://stackoverflow.com/questions/3258243/git-check-if-pull-needed http://stackoverflow.com/questions/3258243/git-check-if-pull-needed
Line 91: Line 136:
 <code> <code>
 git push --tags origin git push --tags origin
 +</code>
 +  * Descargar un tag determinado:
 +<code>
 +git clone -b 'v1.0' --single-branch --depth 1 https://github.com/Kedu-SCCL/redmine-automation
 </code> </code>
  
Line 146: Line 195:
  
 Resultado: el directorio "/srv/www/test" tendria que tener el contenido de del repositori "/srv/git/test.git" expandido Resultado: el directorio "/srv/www/test" tendria que tener el contenido de del repositori "/srv/git/test.git" expandido
 +
 +==== GITHUB ====
 +Vamos a Settings "SSH and GPG keys" y añadimos la clave.
 +
 +Creamos el repositorio en GITHUB. Mejor no inicializar con README.md Allí pone las instrucciones:
 +<code>
 +git init .
 +git add .
 +git commit -m "primer commit"
 +git remote add origin git@github.com:iwanttobefreak/docker-selenium.git
 +git push -u origin master
 +</code>
 +
 +
  
informatica/git.txt · Last modified: 2022/01/06 20:19 by jose