git push https://github.com/cmorones/spdgm.git --force
Mostrando entradas con la etiqueta GIT. Mostrar todas las entradas
Mostrando entradas con la etiqueta GIT. Mostrar todas las entradas
miércoles, 19 de octubre de 2016
miércoles, 21 de septiembre de 2016
Crear, merge y eliminar un branch GIT
$git checkout -b rama1 // se crea una rama
$touch file2.txt
$git add .
$git commit " Nuevo file"
$git checkout master //se cambia al branch master
$git merge rama1 // se funciona el file
cesar@sisweb:~/learning-git$ git log
commit dc2c5091a18f0532853ac695cf95cbf99883d2ed
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Wed Sep 21 09:47:51 2016 -0500
Nuevo file
commit f8948973df81a18d809247e1e0236d5dcd137e9e
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Wed Sep 21 09:08:17 2016 -0500
primer commit2
$touch file2.txt
$git add .
$git commit " Nuevo file"
$git checkout master //se cambia al branch master
$git merge rama1 // se funciona el file
cesar@sisweb:~/learning-git$ git log
commit dc2c5091a18f0532853ac695cf95cbf99883d2ed
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Wed Sep 21 09:47:51 2016 -0500
Nuevo file
commit f8948973df81a18d809247e1e0236d5dcd137e9e
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Wed Sep 21 09:08:17 2016 -0500
primer commit2
lunes, 1 de diciembre de 2014
Fusiones
Fusiones
Solución de conflictos
a) Fast-Forward
b) Manual Merge
Fast-Forward
Los gestores trabajaron archivos diferentes al repositorio
Manual Merge
¿Qué pasa cuando 2 desarrolladores trabajan el mismo archivo en la fusión?
RAMAS
2.2 Ramas
El concepto HEAD
¿En qué punto de la historia de nuestro proyecto nos encontramos?
git branch [nombre]
git log --oneline --graph --all
git config --global alias.nicelog 'log --oneline --graph --all'
Repositorios "forked"
Repositorios "forked"
Crear ó entrar a la carpeta del proyecto
$ git remote add origin [HTTPS ó SSH del proyecto forked]
$ git remote add upstream [HTTPS ó SSH del proyecto "main"]
$ git fetch upstream
$ git merge origin/upstream
$ git fetch origin
$ git merge origin/master
Hacer cambios en local
$ git fetch upstream
$ git merge origin/upstream
$ git push origin master
Crear ó entrar a la carpeta del proyecto
$ git remote add origin [HTTPS ó SSH del proyecto forked]
$ git remote add upstream [HTTPS ó SSH del proyecto "main"]
$ git fetch upstream
$ git merge origin/upstream
$ git fetch origin
$ git merge origin/master
Hacer cambios en local
$ git fetch upstream
$ git merge origin/upstream
$ git push origin master
Subir cambios a GitHub
Subir cambios a GitHub
$ git init$ git remote add origin [HTTPS or SSH]
$ git remote -v
Generamos cambios
$ git commit -am "[Mensaje]"
$ git push origin master
Git Fetch & Git Merge
Git Fetch & Git Merge
Creamos ó entramos a la carpeta de nuestro proyecto
$ git init (si apenas vamos a iniciar)
$ git remote add origin [HTTS or SSH]
$ git fetch origin
$ git merge origin/master
Hacen cambios
$ git fetch origin
$ git merge origin/master
$ git push origin master
Creamos ó entramos a la carpeta de nuestro proyecto
$ git init (si apenas vamos a iniciar)
$ git remote add origin [HTTS or SSH]
$ git fetch origin
$ git merge origin/master
Hacen cambios
$ git fetch origin
$ git merge origin/master
$ git push origin master
viernes, 13 de junio de 2014
Instalar smartgit en ubuntu
1993 sudo add-apt-repository ppa:eugenesan/ppa
1994 sudo apt-get update
1995 sudo apt-get install smartgit
1996 sudo apt-get install smartgithg
viernes, 6 de junio de 2014
Uso de GIT y github
Instalar GIT
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
jueves, 3 de abril de 2014
sábado, 15 de marzo de 2014
Viendo el historico de confirmaciones
cms@desarrollo:/var/www/git$ git log
commit bc35ba474ea65a0109a4fd2454c41663afa3d7f1
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Sat Mar 15 22:52:51 2014 -0600
Version 2
commit bd40eb2faad229970d8c7dfabd2328bacfc12b2c
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Sat Mar 15 22:14:19 2014 -0600
Version inicial
Por defecto, si no pasas ningún argumento,
cms@desarrollo:/var/www/git$ git log --pretty=oneline
bc35ba474ea65a0109a4fd2454c41663afa3d7f1 Version 2
bd40eb2faad229970d8c7dfabd2328bacfc12b2c Version inicial

Figura 2-2. El visualizador de histórico gitk.
commit bc35ba474ea65a0109a4fd2454c41663afa3d7f1
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Sat Mar 15 22:52:51 2014 -0600
Version 2
commit bd40eb2faad229970d8c7dfabd2328bacfc12b2c
Author: Cesar Morones <cesar.morones1@gmail.com>
Date: Sat Mar 15 22:14:19 2014 -0600
Version inicial
Por defecto, si no pasas ningún argumento,
git log lista
las confirmaciones hechas sobre ese repositorio en orden cronológico
inverso. Es decir, las confirmaciones más recientes se muestran al
principio. Como puedes ver, este comando lista cada confirmación con su
suma de comprobación SHA-1, el nombre y dirección de correo del autor,
la fecha y el mensaje de confirmación.cms@desarrollo:/var/www/git$ git log --pretty=oneline
bc35ba474ea65a0109a4fd2454c41663afa3d7f1 Version 2
bd40eb2faad229970d8c7dfabd2328bacfc12b2c Version inicial
Usando un interfaz gráfico para visualizar el histórico
Si deseas utilizar una herramienta más gráfica para visualizar el histórico de confirmaciones, puede que quieras echarle un ojo a un programa Tcl/Tk llamado gitk que se distribuye junto con Git. Gitk es básicamente ungit log visual, y acepta casi todas las opciones de filtrado que acepta git log. Si tecleas gitk en la línea de comandos dentro de tu proyecto, deberías ver algo como lo de la Figura 2-2.Figura 2-2. El visualizador de histórico gitk.
Comprobando el status de tus archivos
cms@desarrollo:/var/www/git$ git status
# On branch master
nothing to commit (working directory clean)
El comando te dice en qué rama estás. Por ahora, esa rama siempre es "master", que es la predeterminada.
si agregamos un archivo
cms@desarrollo:/var/www/git$ touch index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# index.html
nothing added to commit but untracked files present (use "git add" to track)
Para empezar el seguimiento de un nuevo archivo se usa el comando
cms@desarrollo:/var/www/git$ git add index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: index.html
#
Puedes ver que está preparado porque aparece bajo la cabecera “Cambios a confirmar” (“Changes to be committed”).
Al modificar el archivo index.html pero aun no esta preparado
cms@desarrollo:/var/www/git$ nano index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: index.html
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.html
Archivo preparado
cms@desarrollo:/var/www/git$ git add index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: index.html
#
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README
# new file: index.html
#
Se modifico y se se preparo.
Ignorando archivos
# On branch master
nothing to commit (working directory clean)
El comando te dice en qué rama estás. Por ahora, esa rama siempre es "master", que es la predeterminada.
si agregamos un archivo
cms@desarrollo:/var/www/git$ touch index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# index.html
nothing added to commit but untracked files present (use "git add" to track)
Para empezar el seguimiento de un nuevo archivo se usa el comando
git add.cms@desarrollo:/var/www/git$ git add index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: index.html
#
Puedes ver que está preparado porque aparece bajo la cabecera “Cambios a confirmar” (“Changes to be committed”).
Al modificar el archivo index.html pero aun no esta preparado
cms@desarrollo:/var/www/git$ nano index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: index.html
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.html
Archivo preparado
cms@desarrollo:/var/www/git$ git add index.html
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: index.html
#
cms@desarrollo:/var/www/git$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README
# new file: index.html
#
Se modifico y se se preparo.
Ignorando archivos
$ cat .gitignore
*.[oa]
*~
Instalar y Configurar GIT
Para instalar Git, necesitas tener las siguientes librerías de las
que Git depende: curl, zlib, openssl, expat, y libiconv. Por ejemplo, si
estás en un sistema que tiene yum (como Fedora) o apt-get (como un
sistema basado en Debian), puedes usar estos comandos para instalar
todas las dependencias:
Instalar
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev
Instalar
$ apt-get install gitConfigurar GIT$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ git config --global core.editor emacs
$ git config --global merge.tool vimdiff
Ver configuracion
cms@desarrollo:~$ git config --list
user.name=Cesar Morones
user.email=cesar.morones1@gmail.com
core.editor=sublime2
merge.tool=vimdiff
Estados de GIT
Git tiene tres estados principales en los que se pueden encontrar tus
archivos: confirmado (committed), modificado (modified), y preparado
(staged). Confirmado significa que los datos están almacenados de manera
segura en tu base de datos local. Modificado significa que has
modificado el archivo pero todavía no lo has confirmado a tu base de
datos. Preparado significa que has marcado un archivo modificado en su
versión actual para que vaya en tu próxima confirmación.
Suscribirse a:
Entradas (Atom)
