código fuente disponible:
Calculamos el sha-1 de la palabra "versionamiento"
La misma palabra (o archivo) genera siempre el mismo hash
$ echo -n versionamiento | sha1sum
103e878be00120776aa8682e848253d7c3678d12 -
apt-get install git # Debian / Ubuntu
yum install git-all # Fedora
Establecer nombre y correo electrónico
git config --global user.name "Elmer Mendoza"
git config --global user.email "defreddyelmer@gmail.com"
Ver la configuración establecida (~/.gitconfig)
git config --list
user.name=Elmer Mendoza
user.email=defreddyelmer@gmail.com
Desde un directorio local
git init
Desde un repositorio existente
git clone https://IP_O_DOMINIO_SERVIDOR_REMOTO/nombre-proyecto.git
git status
On branch master
Changes to be committed:
new file: INSTALL.md
Changes not staged for commit:
modified: index.html
git add [nombre-archivo]
git add index.html INSTALL.md
git add .
git commit -m "Mensaje que describe el cambio"
Adicionar y confirmar todos los cambios
git commit -a
commit 8fa49b94256bce45e6017eb807b67f5fee2fa77b
Author: Mary Rosales
Date: Mon Jan 8 11:59:07 2018 -0400
Agregando conceptos de integridad
commit eda9eb790a1d366b46b28b120fb3e8ac98421c88
Author: Elmer Mendoza
Date: Mon Jan 8 11:40:11 2018 -0400
Adición de conceptos fundamentales sobre VCS
git remote --verbose
gitlab https://gitlab.com/elmerfreddy/git.git (fetch)
gitlab https://gitlab.com/elmerfreddy/git.git (push)
origin https://github.com/elmerfreddy/git.git (fetch)
origin https://github.com/elmerfreddy/git.git (push)
Añadir repositorio remoto
git remote add [nombre-repositorio] [url-repositorio]
Eliminar repositorio remoto
git remote rm [nombre-repositorio]
git pull [nombre-repositorio] [nombre-rama]
git pull origin master
From https://github.com/elmerfreddy/git
* branch master -> FETCH_HEAD
Updating fa3bfeb..d59d2b1
Fast-forward
img/basic-remote-workflow.png | Bin 0 -> 76802 bytes
img/flujo.png | Bin 0 -> 7745 bytes
img/rendimiento.png | Bin 0 -> 19442 bytes
img/staging.jpg | Bin 0 -> 66869 bytes
index.html | 96 ++++++++++++++++++++++++++++++++
5 files changed, 96 insertions(+)
create mode 100644 img/basic-remote-workflow.png
create mode 100644 img/flujo.png
create mode 100644 img/rendimiento.png
create mode 100644 img/staging.jpg
git push [nombre-repositorio] [nombre-rama]
git push origin master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 8.04 KiB | 0 bytes/s, done.
Total 5 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/elmerfreddy/git.git
ee9f91f..d59d2b1 master -> master
$ git branch NOMBRE_DE_LA_RAMA #crea la rama
$ git checkout -b NOMBRE_DE_LA_RAMA # crea la rama y entra a la misma
$ git checkout NOMBRE_DE_LA_RAMA
$ git merge NOMBRE_DE_LA_SEGUNDA_RAMA