• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Introducción a git y GitHub
 

Introducción a git y GitHub

on

  • 1,731 views

Diapositivas de la charla dada por la gente de uno21.com.ar (@luke_ar y @matitanio) en la UP, el día 21/08/2012. Próximamente en otras universidades :)

Diapositivas de la charla dada por la gente de uno21.com.ar (@luke_ar y @matitanio) en la UP, el día 21/08/2012. Próximamente en otras universidades :)

Statistics

Views

Total Views
1,731
Views on SlideShare
1,295
Embed Views
436

Actions

Likes
2
Downloads
24
Comments
0

7 Embeds 436

http://hernanchilabert.com.ar 206
http://blog.uno21.com.ar 167
http://www.hernanchilabert.com.ar 51
https://twitter.com 8
http://app.filament.io 2
http://coderwall.com 1
https://es.twitter.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introducción a git y GitHub Introducción a git y GitHub Presentation Transcript

    • git /ɡɪt/ @luke_ar#charlagit uno21.com.ar @matitanio
    • ¿qué es git?
    • ¿qué es git? un scv
    • un sistema de control de versiones es nuestro  DeLorean personal quenos permitirá viajar por la historia de un archivo y nos proveerá facilidadespara el trabajo en equipo
    • repo revision fork commit tree branchlabel head conflict update trunk check­out tagcheck­in working copy change list merge
    • ¿qué es git?
    • git es un sistema de control de versiones distribuído decódigo abierto diseñado para la velocidad y eficiencia
    • git es un sistema de control de versiones distribuido decódigo abierto diseñado para la velocidad y eficiencia
    • totalmente distribuido
    • (casi) todo es local
    • lo que significa que todo es rápidocada repositorio es un backup se puede trabajar off­line
    • no se necesita red para hacer un diff ver el histórico commitear cambios mergear branchesobtener una revisión de un archivo cambiar de branch
    • git es un sistema de control de versiones distribuído decódigo abierto diseñado para la velocidad y eficiencia
    • git­scm.com
    • github.com/git/git
    • git es un sistema de control de versiones distribuido decódigo abierto diseñado para la velocidad y eficiencia
    • inmutable
    • (casi) nunca se borran datos
    • snapshots, no parches
    • (eso lo dejamos para después)
    • git local
    • demo  ㋡
    • primeros pasos
    • git config$ git config --global user.name "Lucas Videla"$ git config --global user.email"lucas@uno21.com.ar"$ git config --global color.ui true
    • git init$ git initInitialized empty Git repository in/home/lucas/workspace/demo-git/.git/
    • git status$ git status# On branch master## Initial commit## Untracked files:# (use "git add <file>..." to include in whatwill be committed)## README.mdnothing added to commit but untracked filespresent (use "git add" to track)
    • git add$ git add README.md$ git status# On branch master## Initial commit## Changes to be committed:# (use "git rm --cached <file>..." tounstage)## new file: README.md#
    • git status$ git status# On branch master# Initial commit# Changes to be committed:# (use "git rm --cached <file>..." to unstage)# new file: README.md## Changes not staged for commit:# (use "git add <file>..." to update what will becommitted)# (use "git checkout -- <file>..." to discardchanges in working directory)# modified: README.md## Untracked files:# (use "git add <file>..." to include in whatwill be committed)# index.html
    • git add$ git add .$ git status# On branch master## Initial commit## Changes to be committed:# (use "git rm --cached <file>..." tounstage)## new file: README.md# new file: index.html#
    • git commit$ git commit -m "Commit inicial"[master (root-commit) 0b8f623] Commit inicial 2 files changed, 4 insertions(+) create mode 100644 README.md create mode 100644 index.html$ git status# On branch masternothing to commit (working directory clean)
    • git status$ vim README.md$ git status# On branch master# Changes not staged for commit:# (use "git add <file>..." to update whatwill be committed)# (use "git checkout -- <file>..." to discardchanges in working directory)## modified: README.md#
    • git commit$ git commit -am "Cambios en el readme"[master 088d366] Cambios en el readme 1 file changed, 1 insertion(+), 1 deletion(-)
    • git log$ git logcommit 088d366628eeb349ee612123ca6267ca3f98ba2cAuthor: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:21:40 2012 -0300 Cambios en el readmecommit 0b8f623aa377049c1b9a41da5b8ea6de0722cb74Author: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:16:18 2012 -0300 Commit inicial
    • git log$ git logcommit 088d366628eeb349ee612123ca6267ca3f98ba2cAuthor: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:21:40 2012 -0300 Cambios en el readmecommit 0b8f623aa377049c1b9a41da5b8ea6de0722cb74Author: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:16:18 2012 -0300 Commit inicial
    • git log$ git logcommit 088d366628eeb349ee612123ca6267ca3f98ba2cAuthor: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:21:40 2012 -0300 Cambios en el readmecommit 0b8f623aa377049c1b9a41da5b8ea6de0722cb74Author: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:16:18 2012 -0300 Commit inicial
    • git log$ git logcommit 088d366628eeb349ee612123ca6267ca3f98ba2cAuthor: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:21:40 2012 -0300 Cambios en el readmecommit 0b8f623aa377049c1b9a41da5b8ea6de0722cb74Author: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:16:18 2012 -0300 Commit inicial
    • git log$ git logcommit 088d366628eeb349ee612123ca6267ca3f98ba2cAuthor: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:21:40 2012 -0300 Cambios en el readmecommit 0b8f623aa377049c1b9a41da5b8ea6de0722cb74Author: Lucas Videla <lucas@uno21.com.ar>Date: Wed Aug 15 14:16:18 2012 -0300 Commit inicial
    • git lol* $ git lol * 088d366 (HEAD, master) Cambios en el readme * 0b8f623 Commit inicial088d366 HEAD master0b8f623
    • git branch $ git branch * master $ git checkout -b fondoAzul Switched to a new branch fondoAzul $ git branch * fondoAzul master088d366 HEAD master fondoAzul0b8f623
    • git add $ vim index.html $ git commit -am "Se cambia el fondo a azul" [fondoAzul d20ddf9] Se cambia el fondo a azul 1 file changed, 1 insertion(+), 1 deletion(-)d20ddf9 HEAD fondoAzul088d366 master0b8f623
    • git checkout $ git checkout master Switched to branch master $ vim index.html $ git commit -am "Se cambia la letra a título" [master 45ba368] Se cambia la letra a título 1 file changed, 1 insertion(+), 1 deletion(-)d20ddf9 fondoAzul 45ba368 master HEAD088d3660b8f623
    • git merge $ git merge fondoAzul Auto-merging index.html Merge made by the recursive strategy. index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)e9de90a master HEADd20ddf9 fondoAzul 45ba368088d3660b8f623
    • git tag $ git tag -a v0.0.1 -m "Primera versión del sitio" $ git tag V0.0.1e9de90a master HEAD tag: v0.0.1d20ddf9 fondoAzul 45ba368088d3660b8f623
    • git branch ­d $ git branch -d fondoAzul Deleted branch fondoAzul (was ce1c815).e9de90a master HEAD tag: v0.0.1d20ddf9 45ba368088d3660b8f623
    • git checkout $ git checkout 088d366 index.html ?e9de90a master HEAD tag: v0.0.1d20ddf9 45ba368088d3660b8f623
    • git diff$ git diff --cacheddiff --git a/index.html b/index.htmlindex 1007883..ae750ea 100644--- a/index.html+++ b/index.html@@ -1,7 +1,7 @@ <html> <head> </head>-<body style="background-color: blue;">+<body> <h1>Bienvenido!</h1>
    • git commit $ git commit -am "Se restaura index" [master f2736c8] Se restaura index 1 file changed, 1 insertion(+), 1 deletion(-)f2736c8 master HEADe9de90a tag: v0.0.1d20ddf9 45ba368088d3660b8f623
    • Breve repaso git config git init git add git commit git log git branch git checkout git diff
    • Breve repaso git config git init git add git commit git log git branch git checkout git diff
    • workflow git básico(a.k.a. “cómo trabajar con git”)
    • directoriode trabajo indexrepositorio
    • directorio la copia de trabajo de trabajo del proyecto index el estado  intermedio, stagerepositorio base de datos con la  historia del proyecto
    • 1. editar archivos2. pasar a stage3. revisar cambios4. hacer commit
    • directoriode trabajo git add index git commitrepositorio
    • git remoto
    • demo 2  ㋡
    • http://github.com
    • git remote$ git remote add origingit@github.com:delucas/demo-git.git$ git remoteorigin
    • git push$ git push origin masterCounting objects: 17, done.Delta compression using up to 4 threads.Compressing objects: 100% (15/15), done.Writing objects: 100% (17/17), 1.66 KiB, done.Total 17 (delta 2), reused 0 (delta 0)To git@github.com:delucas/demo-git.git * [new branch] master -> master
    • ¡Momento! origin/master f2736c8 master HEAD e9de90a tag: v0.0.1 d20ddf9 45ba368 088d366 0b8f623
    • git clone$ git clone git@github.com:delucas/demo-git.gitCloning into demo-git...remote: Counting objects: 17, done.remote: Compressing objects: 100% (13/13),done.remote: Total 17 (delta 2), reused 17 (delta 2)Receiving objects: 100% (17/17), done.Resolving deltas: 100% (2/2), done.
    • git pull$ git pull origin masterremote: Counting objects: 5, done.remote: Compressing objects: 100% (3/3), done.remote: Total 3 (delta 0), reused 3 (delta 0)Unpacking objects: 100% (3/3), done.From github.com:delucas/demo-git * branch master -> FETCH_HEADUpdating f2736c8..5c565c5Fast-forward index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
    • ¡Momento! origin/master 5c565c5 master HEAD f2736c8 e9de90a tag: v0.0.1 d20ddf9 45ba368 088d366 0b8f623
    • git commit$ git commit -am "Se establece fondo azul"[master aca1dbf] Se establece fondo azul 1 file changed, 1 insertion(+), 1 deletion(-)
    • ¡Momento! aca1dbf master HEAD 5c565c5 origin/master f2736c8 e9de90a tag: v0.0.1 d20ddf9 45ba368 088d366 0b8f623
    • git push$ git push origin masterTo git@github.com:delucas/demo-git.git ! [rejected] master -> master (non-fast-forward)error: failed to push some refs togit@github.com:delucas/demo-git.gitTo prevent you from losing history, non-fast-forward updates were rejectedMerge the remote changes (e.g. git pull)before pushing again. See theNote about fast-forwards section of git push--help for details.
    • git pull$ git pull origin masterremote: Counting objects: 8, done.remote: Compressing objects: 100% (6/6), done.remote: Total 6 (delta 0), reused 6 (delta 0)Unpacking objects: 100% (6/6), done.From github.com:delucas/demo-git * branch master -> FETCH_HEADAuto-merging index.htmlCONFLICT (content): Merge conflict inindex.htmlAutomatic merge failed; fix conflicts and thencommit the result.
    • ¡Momento! master aca1dbf 27ac778 HEAD 5c565c5 origin/master f2736c8 e9de90a tag: v0.0.1 d20ddf9 45ba368 088d366 0b8f623
    • git diff$ git diffdiff --cc index.htmlindex fba4d43,f5f9763..0000000--- a/index.html+++ b/index.html@@@ -1,7 -1,7 +1,11 @@@ <html> <head> </head>++<<<<<<< HEAD +<body style="background-color:blue;">++=======+ <body style="background-color:red;">++>>>>>>>27ac778abf019e73d9bb3eb99b10cce0877b9108 <h1>Welcome!</h1>
    • git diff$ git status# On branch master# Unmerged paths:# (use "git add/rm <file>..." as appropriateto mark resolution)## both modified: index.htmlno changes added to commit (use "git add"and/or "git commit -a")$ git diffdiff --cc index.htmlindex fba4d43,f5f9763..0000000--- a/index.html+++ b/index.html$ git commit -am "Se resuelve conflicto demerge"[master e3be094] Se resuelve conflicto de merge
    • ¡Momento! master HEAD e3be094 aca1dbf 27ac778 5c565c5 origin/master f2736c8 e9de90a tag: v0.0.1 d20ddf9 45ba368 088d366 0b8f623
    • git push$ git push origin masterCounting objects: 8, done.Delta compression using up to 4 threads.Compressing objects: 100% (4/4), done.Writing objects: 100% (4/4), 503 bytes, done.Total 4 (delta 1), reused 0 (delta 0)To git@github.com:delucas/demo-git.git 27ac778..e3be094 master -> master
    • ¡Momento! origin/master e3be094 master HEAD aca1dbf 27ac778 5c565c5 f2736c8 e9de90a tag: v0.0.1 d20ddf9 45ba368 088d366 0b8f623
    • entendiendo git
    • snapshots, no parches gracias, Scott! (@chacon)
    • el modelo de objetos
    • el modelo de objetos
    • el objeto commit
    • el objeto commit
    • el objeto commit
    • los branches
    • (es un puntero a un commit)
    • HEAD
    • git branch experiment
    • git checkout experiment
    • git commit
    • git commit
    • git checkout default
    • git commit
    • git checkout experimentgit commit
    • merge
    • git checkout default
    • git merge experiment
    • (pausa)
    • ¿preguntas?
    • recursos git
    • git­scm.com
    • help.github.com
    • gitimmersion.com
    • gitcasts.com
    • codeschool.com/courses/try­git
    • nvie.com/posts/a­successful­git­branching­model/
    • ¡muchas gracias! @luke_ar#charlagit @matitanio