Bluekite git

355 views

Published on

Una introducción a la herramienta para versionado Git. Parte de la iniciativa Bluekite TechFriday

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
355
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • VCS rcs Suma los patches
  • Colaboracion CVS Subversion Perforce Checkout de archivos Se cae el server!!! Se corrompe la db! Hay que estar conectado! Lentos
  • Colaboracion CVS Subversion Perforce Checkout de archivos Se cae el server!!! Se corrompe la db! Hay que estar conectado! Lentos
  • Kernel BitKeeper Nace 2005
  • Cvs Subversion Perforce Bazar Cambios realizados por archivos
  • Mini filesystem Toma una foto Guarda archivos cambiados Genera un link a la ultima version de los no cambiados Operaciones locales, super rapido Difrencia hace un mes Offline
  • Git directory = db Git clone <= directory Working es un checkout de una version de repo Staging => archivo dentro de directory == Index Que entrara en el commit
  • Because a branch in Git is in actuality a simple file that contains the 40 character SHA-1 checksum of the commit it points to, branches are cheap to create and destroy. Creating a new branch is as quick and simple as writing 41 bytes to a file (40 characters and a newline).
  • It’s worth noting here that the work you did in your hotfix branch is not contained in the files in your iss53 branch. If you need to pull it in, you can merge your master branch into your iss53 branch by running git merge master, or you can wait to integrate those changes until you decide to pull the iss53 branch back into master later.
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Git does a simple three-way merge, using the two snapshots pointed to by the branch tips and the common ancestor of the two. Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it Git automatically identifies the best common-ancestor merge base for branch merging
  • Bluekite git

    1. 1. #TechFriday No. 1 GitDistribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    2. 2. #TechFriday No. 1 Javier Alvarez @jmangtDistribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    3. 3. #TechFriday - Git Capacitación Continua Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    4. 4. #TechFriday - Git 2 Semanas Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    5. 5. #TechFriday - Git Software Libre Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    6. 6. #TechFriday - Git GIT Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    7. 7. #TechFriday - Git Control de Versiones Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    8. 8. #TechFriday - Git Cambios a los archivosDistribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    9. 9. #TechFriday - Git Versionamiento por Copy / Paste Archivo Archivo V1 Archivo V2 Archivo V1 Final Archivo V2 Cambios Archivo V1 Final - Final Archivo V1 Final – Final Copia Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    10. 10. #TechFriday - Git Versionamiento Local Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    11. 11. #TechFriday - Git Sistemas Centralizados Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    12. 12. #TechFriday - Git Sistemas Distribuidos Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    13. 13. #TechFriday - Git Historia Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    14. 14. #TechFriday - Git Linux FTW!LinusTorvalds Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    15. 15. #TechFriday - Git Rápido, Simple, Branches, Distribuido Escalable Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    16. 16. #TechFriday - Git Lo Básico Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    17. 17. #TechFriday - Git Snapshots No Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    18. 18. #TechFriday - Git Versionado por Diferencias Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    19. 19. #TechFriday - Git Versionado por Snapshot Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    20. 20. #TechFriday - Git Integridad SHA-1 hash Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    21. 21. #TechFriday - Git 24b9da6552252987aa493b52f8696cd6d3b00373 Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    22. 22. #TechFriday - Git Solo agrega data Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    23. 23. #TechFriday - Git Tres Estados (stages) Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    24. 24. #TechFriday - Git Working Staging Git Directory Directory Area (repositorio) Checkout del Proyecto Preparar archivos Commit Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    25. 25. #TechFriday - Git 1. Modificar Archivo 2. Snapshot a Stage 3. Commit Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    26. 26. #TechFriday - Git Instalación Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    27. 27. #TechFriday - Git Instalación # Ubuntu $ sudo apt-get install git-core # Redhat 6 / Centos 6 $ sudo yum install git # MacOsX con homebrew $ brew install git # Windows http://msysgit.github.com/ Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    28. 28. #TechFriday - Git Configuració n Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    29. 29. #TechFriday - Git Identidad $ git config –-global user.name “Javier Alvarez” $ git config –-global user.email “jalvarez@bluekite” Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    30. 30. #TechFriday - Git Editor $ git config –-global core.editor emacs Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    31. 31. #TechFriday - Git Herramienta para Diff $ git config –-global merge.tool meld Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    32. 32. #TechFriday - Git Configuración $ git config –-list user.name=Javier Alvarez user.email=jalvarez@bluekite.com merge.tool=meld core.editor=emacs $ git config user.name Javier Alvarez Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    33. 33. #TechFriday - Git Ayuda $ git help <accion> $ git help checkout GIT-CHECKOUT(1) Git Manual GIT-CHECKOUT(1) NAME git-checkout - Checkout a branch or paths to the working tree SYNOPSIS git checkout [-q] [-f] [-m] [<branch>] git checkout [-q] [-f] [-m] [--detach] [<commit>] git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>] git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>... git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...] Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    34. 34. #TechFriday - Git Workflow Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    35. 35. #TechFriday - Git Inicializar un Repositorio $ cd $ mkdir MiProyecto $ cd MiProyecto $ git init Initialized empty Git repository in /home/javier/MiProyecto/.git/ Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    36. 36. #TechFriday - Git Agregar archivos al repositorio $ cd ~/MiProyecto $ touch index.html aboutus.html README $ mkdir pages $ touch pages/products.html $ git add *.html $ git add README $ git add pages $ git commit -m “Carga inicial de archivos” Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    37. 37. #TechFriday - Git Clonar un Repositorio $ cd ~ $ git clone git@github.com:jalvarezsamayoa/mi_proyecto.git => ~/mi_proyecto $ git clone git@github.com :jalvarezsamayoa/mi_proyecto.git ElProyecto => ~/ElProyecto Protocolos: • Git:// • Http:// • Https:// Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    38. 38. #TechFriday - Git Grabar cambios al repositorio Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    39. 39. #TechFriday - Git Operaciones Frecuentes # estado de mis archivos $ git status # agregarlos a stage $ git add <File>/<Dir> # ignorar archivos $ emacs .gitignore # ver cambios $ git diff Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    40. 40. #TechFriday - Git Operaciones Frecuentes # grabar cambios a repositorio $ git commit # remover archivos $ git rm <--cached> file # mover archivos $ git mv original nuevo_nombre # ver historial de commits $ git log Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    41. 41. #TechFriday - Git Operaciones Frecuentes # corregir un commit $ git commit –amend # remover un archivo de stage $ git reset HEAD file # revertir los cambios de un archivo $ git checkout –- file Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    42. 42. #TechFriday - Git Go Live! Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    43. 43. #TechFriday - Git Remotes Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    44. 44. #TechFriday - Git Remotes # clone de un proyecto $ git clone git@github.com:jalvarezsamayoa/mi_proyecto.git $ cd mi_proyecto $ git remote origin # agregar un remote manualmente $ git remote add bitbucket https://jalvarezsamayoa@bitbucket.org/jalvarezsamayoa/mi_proyecto.git $ git remote -v # origin git://github.com/jalvarezsamayoa/mi_proyecto.git # bitbucket https://bitbucket.org/jalvarezsamayoa/mi_proyecto.git Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    45. 45. #TechFriday - Git Fetch y Pull desde un Remote # obtener toda la data que mi copia local no tiene $ git fetch [nombre-remote] # obtener cambios y hacer merge $ git pull [nombre-remote] Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    46. 46. #TechFriday - Git Push cambios a Remote # enviar mis cambios a un remote $ git push [nombre-remote] [nombre-branch] $ git push origin master $ git push bitbucket master # información del remote $ git remote show origin # remover remote $ git remote rm bitbucket Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    47. 47. #TechFriday - Git Tags # obtener un listado de tags $ git tag V0.1 super-feature Estable V0.2 # buscar un tag $ git tag -l v0* V0.1 V0.2 Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    48. 48. #TechFriday - Git Tags # crear un tag anotado $ git tag -a v0.3 -m Version 0.3 $ git tag V0.1 V0.2 V0.3 # ver informacion del tag $ git show v.03 Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    49. 49. #TechFriday - Git Tags # firmar un tag con GPG $ git tag -s v0.3 -m Version 0.3 firmada You need a passphrase to unlock the secret key for user: "Javier Alvarez <jalvarez@blukite.com>" 1024-bit DSA key, ID F721C45A, created 2009-02-09 $ git show v0.3 tag v0.3 Tagger: Javier Alvarez <jalvarez@bluekite.com> Date: Mon Feb 9 15:22:20 2009 -0800 Version 0.3 firmada -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEABECAAYFAkmQurIACgkQON3DxfchxFr5cACeIMN+ZxLKggJQf0QYiQBwgySN Ki0An2JeAVUCAiJ7Ox6ZEtK+NvZAj82/ =WryJ -----END PGP SIGNATURE----- Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    50. 50. #TechFriday - Git Push Tags # tranferir tags a un remote $ git push origin [nombre-tag] $ git push origin v0.3 Counting objects: 50, done. Compressing objects: 100% (38/38), done. Writing objects: 100% (44/44), 4.56 KiB, done. Total 44 (delta 18), reused 8 (delta 1) To git@github.com:jalvarezsamayoa/mi_proyecto.git * [new tag] v0.3 -> v0.3 Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    51. 51. #TechFriday - Git Tags # crear un tag anotado $ git tag -a v0.3 -m Version 0.3 $ git tag V0.1 V0.2 V0.3 # ver informacion del tag $ git show v.03 Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    52. 52. #TechFriday - Git Branches Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    53. 53. #TechFriday - Git Killer Feature Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    54. 54. #TechFriday - Git Snapshot Puntero Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    55. 55. #TechFriday - Git Go Live! Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    56. 56. #TechFriday - Git Branches – Objetos creados en un commit $ git add README index.html LICENCIA $ git commit -m Commit Inicial Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    57. 57. #TechFriday - Git Branches – Puntero al commit anterior Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    58. 58. #TechFriday - Git Branches – Puntero al último commit Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    59. 59. #TechFriday - Git Branches – Crear un branch $ git branch testing Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    60. 60. #TechFriday - Git Branches – En que branch estoy - HEAD Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    61. 61. #TechFriday - Git Branches – Cambiar de Branch $ git checkout testing Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    62. 62. #TechFriday - Git Branches – Realizar un cambio $ emacs index.html $ git commit -am “cambio” Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    63. 63. #TechFriday - Git Branches – Regresar a Master $ git checkout master Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    64. 64. #TechFriday - Git Branches – Divergencia $ emacs index.html $ git commit -am “cambio a master” Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    65. 65. #TechFriday - Git Merging Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    66. 66. #TechFriday - Git 1. Trabajo en mi proyecto 2. Creo un branch para mi feature 3. Hago cambios a mi branch Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    67. 67. #TechFriday - Git CAMBIO SUPER IMPORTANTE QUE NO PUEDE ESPERAR O LOS MAYAS DESTRUIRAN AL MUNDO!!! ( con los terrorristas...) Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    68. 68. #TechFriday - Git 1. Regreso a master 2. Crear HotFix branch 3. Test. Merge HotFix → Master 4. Push a Producción 5. Regreso a Feature Branch Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    69. 69. #TechFriday - Git Merging – Mi Proyecto Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    70. 70. #TechFriday - Git Merging – Crear un feature branch $ git branch -b iss53 Switched to a new branch "iss53" Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    71. 71. #TechFriday - Git Merging – Cambios en feature branch $ emacs index.html $ git commit -am “nuevo footer #53” Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    72. 72. #TechFriday - Git Do the Harlem shake! Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    73. 73. #TechFriday - Git Merging – Regresar a Master y Reparar Bug $ git checkout master Switched to branch "master" $ git checkout -b hotfix Switched to branch "hotfix" $ emacs index.html $ git commit -am “arregle bug” Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    74. 74. #TechFriday - Git Merging – Regresar a master y hacer merge $ git checkout master Switched to branch "master" $ git merge hotfix Updating f42c576..3a0874c Fast forward README | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    75. 75. #TechFriday - Git Merging – Borrar HotFix Branch $ git branch -d hotfix Deleted branch hotfix (3a0874c). Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    76. 76. #TechFriday - Git Merging – Regresar a Feature branch y editar $ git checkout iss53 Switched to branch "iss53" $ emacs index.html $ git commit -am termine #53 [iss53]: created ad82d7a: "finished the new footer [issue 53]" 1 files changed, 1 insertions(+), 0 deletions(-) Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    77. 77. #TechFriday - Git Merging – Regresar a master y hacer merge $ git checkout master Switched to branch "master" $ git merge hotfix Updating f42c576..3a0874c Fast forward README | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    78. 78. #TechFriday - Git Merging – Nuevo commit y snapshot $ git branch -d iss53 Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    79. 79. #TechFriday - Git Merging – Conflictos $ git merge iss53 Auto-merging index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. [master*]$ git status index.html: needs merge # 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) # # unmerged: index.html # Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    80. 80. #TechFriday - Git Merging – Conflictos <<<<<<< HEAD:index.html <div id="footer">contact : email.support@github.com</div> ======= <div id="footer"> please contact us at support@github.com </div> >>>>>>> iss53:index.html Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    81. 81. #TechFriday - Git Merging – Mergetool $ git mergetool merge tool candidates: kdiff3 tkdiff xxdiff meld gvimdiff opendiff emerge vimdiff Merging the files: index.html Normal merge conflict for index.html: {local}: modified {remote}: modified Hit return to start merge resolution tool (meld): Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    82. 82. #TechFriday - Git Merging – Commit $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: index.html # $ git commit Merge branch iss53 Conflicts: index.html # # It looks like you may be committing a MERGE. # If this is not correct, please remove the file # .git/MERGE_HEAD # and try again. # Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    83. 83. #TechFriday - Git Branch Workflow Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    84. 84. #TechFriday - Git master development topic Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    85. 85. #TechFriday - Git Estable / Prod Inestable / Staging Feature / tmp Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    86. 86. #TechFriday - Git Branch Workflow Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    87. 87. #TechFriday - Git Branch Workflow Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    88. 88. #TechFriday - Git Branch Workflow – Feature branch Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    89. 89. #TechFriday - Git Branch Workflow – Feature branch merge Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    90. 90. #TechFriday - Git Intro... Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    91. 91. #TechFriday - Git Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    92. 92. #TechFriday - Git Distribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala
    93. 93. #TechFriday No. 1 Javier Alvarez @jmangtDistribuido bajo Creative Commons Attribution Share Alike 3.0 Guatemala

    ×