Web social
Tabla de contenidos
La tabla de contenidos pertenece al artículo completo y no al contenido parcial de cada página del mismo si fuese el caso.
Resúmen
Sistema distribuido de control de versiones
Sobre el autor
Gastón tiene 32 años, vive en Argentina / Santa Fe / Santa Fe y su ocupación es Desarrollador de aplicaciones web.
Forma parte del club desde 19/10/2009 a las 20:52 habiendo estado en linea 25/03/2013 a las 18:54 por última vez.
Ha publicado 54 artículos en clubdesarrolladores con un promedio de valoración de 7.97 puntos. Puedes visitar su sitio web en http://devstudios.clubdesarrolladores.com
Estadísticas
$ sudo yum install git
o
$ sudo apt-get install git-core
o lo descargamos desde:
http://git-scm.com/download
Probamos
$ git --version
git version 1.7.1
2 - Inicializar un repositorio vacío
$ cd ~/project
$ git init
3 - Agregar archivos al repositorio
$ git add .$ git commit -a - m "Importación inicial"$ git log
6 - Verificar el estado actual
$ git status
7 - Encontrar diferencias entre commits
$ git diff
$ git diff commit_hash
$ git diff commit_hash_1 commit_hash_2
$ git diff --name-status
$ git diff --name-status commit_hash
$ git diff --name-status commit_hash_1 commit_hash_2
$ git diff HEAD~1$ git branch branch_name$ git branch$ git checkout branch_name
11 - Mezclar branches (el especificado con el actual)
$ git merge branch_name
Ejemplo:
$ git checkout master
$ git merge experimental$ git branch -d branch_name
13 - Eliminando cosas del repositorio
$ git rm path
$ git rm --cached path
Quita solo del repositorio, pero no del disco
14 - Moviendose entre revisiones
$ git checkout commit_hash
$ git checkout master
15 - Moviendose sin hacer commit
$ git stash
$ git stash pop$ git stash list
17 - Crear un branch de un commit anterior
$ git checkout commit_hash
$ git branch branch_name
$ git checkout branch_name
o
$ git checkout -b branch_name commit_hash
Ejemplo:
$ git checkout -b bugfix_branch HEAD~2[c/ode]
18 - Reseteando cambios
[code=bash]$ git reset
Cancela git add
$ git reset --hard
Cancela cambios y vuelve al último commit
$ git reset --hard HEAD~2
Elimina el commit$ git gc
20 - Ignorar archivos
Crear un archivo llamado .gitignore en la raiz del repositorio
Ejemplo de contenido:
*.bak
*.[ao]
tmp/
/directory1/directory2/
/directory1/file1
Apendice
A - Interfaces gráficas
gitk
git-gui
rabbitvsc - git$ git config --global user.name "your name"
$ git config --global user.email "you@something.fun"
$ git config --global color.ui "auto"
$ git config --list
C - Trabajando con un servidor remoto
$ ssh your-user@www.your-server.com
$ mkdir -p ~/some-path/.../.../your-repo.git
$ cd ~/some-path/.../.../your-repo.git
$ git --are init
$ exit[code/]
[code=bash]$ cd your-local-git-repository
$ git remote add origin your-user@www.your-server.com:some-path/.../.../your-repo.git
$ git push origin master
a: Automatizar autenticación ssh
$ cd ~/.ssh
$ ls
$ ssh-keygen -t dsa
$ scp id_dsa.pub user@yoursever.com:.ssh/
$ ssh user@yourserver.com
$ cd ~/.ssh
$ cat id_dsa.pub >> authorized_keys
$ rm id_dsa.pub
$ exit
Referencias:
http://blog.xkoder.com/2008/08/13/git-tutorial-starting-with-git-using-just-10-commands/
http://ioconnor.wordpress.com/2009/05/15/my-git-tutorial-for-ubuntu/
Si tiene alguna pregunta sobre éste artículo por favor deje un comentario y será respondido.
Descargas
El artículo no tiene descargas asociadas
Sus comentarios son importantes.
No hay comentarios para listar, si desea puede crear el primer comentario para este artículo.
Agregar un comentario
Debe estar identificado para agregar un comentario