Mejorando en Git
-
Upload
sergi-gp -
Category
Engineering
-
view
454 -
download
1
description
Transcript of Mejorando en Git
![Page 1: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/1.jpg)
Mejorando en Git
@SergiGP Software Craftsmanship BCN
![Page 2: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/2.jpg)
![Page 4: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/4.jpg)
Personalización
$ vim ~/.gitconfig
$ git st $ git ci -m ‘refactor’ $ git co master
*~ .DS_Store .idea
![Page 5: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/5.jpg)
Personalización
$ git ls
documentación ejemplos avanzados
![Page 6: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/6.jpg)
Cherry Pick
$ git co feature-0002 $ git cherry-pick 0bb6886 $ git log --oneline
Mover cambios entre branches
![Page 7: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/7.jpg)
Cherry Pick
$ git co feature-0002 $ git cherry-pick 0bb6886 $ git log --oneline
Mover cambios entre branches
Se puede hacer cherry pick de rango de commits (1.7.2+)
$ git cherry-pick 0bb6886^..ab768ba Si 0bb6886 no es anterior a ab768ba git falla silenciosamente
![Page 8: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/8.jpg)
Tagging
Marcar commits como importantes.
$ git tag -a v1.4 -m 'my version 1.4’ 9fceb02
$ git push origin v1.4
$ git push origin --tags
Los tags se pushean explicitamente
Pushear todos los tags
$ git tag Listar todos los tags
![Page 9: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/9.jpg)
Merge vs Rebase
Workflow con feature branches.
¿Como reintegramos las features e n m a s t e r c u a n d o e s t á n terminadas?
![Page 10: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/10.jpg)
Merge vs Rebase
$ git co master $ git merge feature-0001
$ git log --oneline
![Page 11: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/11.jpg)
Merge vs Rebase
$ git co feature-0001 $ git rebase master $ git co master $ git rebase feature-0001
$ git log --oneline
![Page 12: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/12.jpg)
Merge vs Rebase
$ git co HEAD~2 (nos vamos dos commits atrás)
rebasemerge
![Page 13: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/13.jpg)
Merge vs Rebase
Merge Rebase
Historial confuso Historial más limpio
Funcionalidad en un solo commit *
Funcionalidad en varios commits
Resolver mismos conflictos varias veces ( git rerere)
A veces requiere force push
![Page 14: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/14.jpg)
Submodules
• Repositorios dentro de repositorios
• Librerías externas en nuestro proyecto que queremos mantener actualizadas
• Mantener en repos para diferentes partes del proyecto
![Page 15: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/15.jpg)
Submodules
• Repositorios dentro de repositorios
• Librerías externas en nuestro proyecto que queremos mantener actualizadas
• Mantener en repos para diferentes partes del proyecto
COMPLEJIDAD ACCIDENTAL
![Page 16: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/16.jpg)
Submodules
$ git submodule add https://github.com/angular/angular.js.git js/angular
$ git clone https://github.com/myrepo $ git submodule init $ git submodule update
Otro miembro del equipo:(o pull…)
![Page 17: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/17.jpg)
Hooks• Realizar algunas acciones cuando pasa “algo” en
nuestro repositorio
• Eventos:• applypatch-msg • pre-applypatch • post-applypath • pre-commit • prepare-commit-msg • post-commit • pre-rebase • post-checkout
• post-merge • pre-recieve • update • post-recieve • post-update • pre-auto-gc • post-rewrite
![Page 18: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/18.jpg)
Hooks (II)
Existen plantillas con ejemplos en todos los repositorios en .git/hooks.
$ cd .git/hooks && cp pre-commit.sample pre-commit
!
$ vim pre-commit
howto y más detalle
![Page 19: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/19.jpg)
Bisect
Manager
Developer
![Page 20: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/20.jpg)
Bisect
- ¡Está petando producción!
Manager
Developer
![Page 21: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/21.jpg)
Bisect
- ¡Está petando producción!
Manager
Developer
![Page 22: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/22.jpg)
Bisect (II)
![Page 23: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/23.jpg)
Bisect (II)
$ git bisect start $ git bisect bad
![Page 24: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/24.jpg)
Bisect (II)
$ git bisect start $ git bisect bad
$ git co HEAD~8
![Page 25: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/25.jpg)
Bisect (II)
$ git bisect start $ git bisect bad
$ git co HEAD~8
![Page 26: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/26.jpg)
Bisect (II)
$ git bisect start $ git bisect bad
$ git bisect good
$ git co HEAD~8
![Page 27: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/27.jpg)
Bisect (III)
![Page 28: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/28.jpg)
Bisect (III)
$ git bisect bad
![Page 29: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/29.jpg)
Bisect (III)
$ git bisect bad
![Page 30: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/30.jpg)
Bisect (III)
$ git bisect bad
$ git bisect good
![Page 31: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/31.jpg)
Bisect (IV)
![Page 32: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/32.jpg)
Bisect (IV)
$ git show C4 $ git blame ficherosospechoso
![Page 33: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/33.jpg)
Bisect (IV)
$ git show C4 $ git blame ficherosospechoso
![Page 34: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/34.jpg)
Bisect (IV)
$ git show C4 $ git blame ficherosospechoso
$ git bisect reset
![Page 35: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/35.jpg)
Bisect (V)
Step 1
Step 2
Step 3
Step 4
![Page 36: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/36.jpg)
Bisect (VI)
$ git bisect [comando]
• visualize
• log [ > nombrefichero ]
• replay nombrefichero
• skip
![Page 37: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/37.jpg)
Bisect
$ git bisect run [ script / tests / compilar… ]
$ git bisect run phpunit --exclude-group=functional
$ git bisect run make
howto y ejemplos
![Page 38: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/38.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
A long time ago in a galaxy far, far away ….
![Page 39: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/39.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
origin
![Page 40: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/40.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
git push origin feature-001
origin
![Page 41: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/41.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
git push origin feature-001
git pull origin feature-001
origin
![Page 42: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/42.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
git push origin feature-001
git pull origin feature-001
git ci -m ‘mejoras rabbitmq’
origin
![Page 43: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/43.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
git push origin feature-001
git pull origin feature-001
git ci -m ‘mejoras rabbitmq’
Eloi sube tus cambios plis
origin
![Page 44: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/44.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
git push origin feature-001
git pull origin feature-001
git ci -m ‘mejoras rabbitmq’
Eloi sube tus cambios plis
NO! espera! que pusheo yo
antes
origin
![Page 45: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/45.jpg)
Gestionando remotos
pablo sergi jordi jesús eloi
git push origin feature-001
git pull origin feature-001
git ci -m ‘mejoras rabbitmq’
Eloi sube tus cambios plis
NO! espera! que pusheo yo
antes…
origin
![Page 46: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/46.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
![Page 47: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/47.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
![Page 48: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/48.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
![Page 49: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/49.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
![Page 50: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/50.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
![Page 51: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/51.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
![Page 52: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/52.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
![Page 53: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/53.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
![Page 54: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/54.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
![Page 55: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/55.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
![Page 56: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/56.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
![Page 57: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/57.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
![Page 58: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/58.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
![Page 59: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/59.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
git pull jesus/feature-001
![Page 60: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/60.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
git pull jesus/feature-001
![Page 61: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/61.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
git pull jesus/feature-001
git push akamon
integration
![Page 62: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/62.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
git pull jesus/feature-001
git push akamon
integration
![Page 63: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/63.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
git pull jesus/feature-001
git push akamon
integration
git pull akamon
integration
![Page 64: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/64.jpg)
Gestionando remotos
pablo
sergi
jordi
jesús
eloi
akamon
git push origin feature-001
git pull pablo feature-001
git ci -m ‘mejoras rabbitmq’
git push pablo feature-001
git pull pablo feature-001
git push origin feature-001
git co integration
git pull jesus/feature-001
git push akamon
integration
git pull akamon
integration
![Page 65: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/65.jpg)
Pull Requests
En un repositorio que no es tuyo (ni tienes permisos):
• Necesitas una funcionalidad que no existe
• Encuentras un bug…
• Ves una posible mejora …
• Si el repo es tuyo (o tienes permisos) para generar debate
Pull Request == Propongo incluir algo en un repo
![Page 66: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/66.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
![Page 67: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/67.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
Hi, I’m DHH and TDD is
DEAD
![Page 68: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/68.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
fork dhh/railsHi, I’m DHH and TDD is
DEAD
![Page 69: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/69.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
fork dhh/railsHi, I’m DHH and TDD is
DEAD
git ci -m ‘remove active record’
![Page 70: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/70.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
fork dhh/railsHi, I’m DHH and TDD is
DEAD
git ci -m ‘remove active record’
Pull Request!
![Page 71: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/71.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
fork dhh/railsHi, I’m DHH and TDD is
DEAD
git ci -m ‘remove active record’
Pull Request!Pull Request
![Page 72: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/72.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
fork dhh/railsHi, I’m DHH and TDD is
DEAD
git ci -m ‘remove active record’
Pull Request!Pull Request
![Page 73: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/73.jpg)
Pull Requests• Haces un fork (copia) de un repositorio
• Modificas tu copia y propones tus cambios
• El propietario los acepta o no …
dhh/rails sergigp/rails
fork dhh/railsHi, I’m DHH and TDD is
DEAD
git ci -m ‘remove active record’
Pull Request!Pull Request
F*CK YOU
![Page 74: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/74.jpg)
Pull Requests
![Page 76: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/76.jpg)
Reflog
Con log, checkout, branch y reset podemos “volver” a cualquier commit.
Con reflog, checkout, branch y reset podemos “volver” a cualquier estado.
log es un listado de commits!!
reflog es un listado de HEADs referencias
![Page 77: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/77.jpg)
Reflog
$ git reflog
Que son referencias en git? HEADs, stash, tags, bisect … $ ls -l .git/refs
$ git reflog show feature-0002
![Page 78: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/78.jpg)
Fsck
• Si reflog no funciona… que no cunda el panico
• fsck comprueba la integridad de la BD de git. Luego podemos recuperar objetos y referencias perdidas con alguna copia de seguridad
• Flags --full y --unreachable
![Page 79: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/79.jpg)
Filter branch
Git está diseñado para no perder nunca cambios realizados… ¿Pero que pasa si queremos perderlos?
!
![Page 80: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/80.jpg)
Filter branch
Git está diseñado para no perder nunca cambios realizados… ¿Pero que pasa si queremos perderlos?
!
eliminar passwords de producción commiteados y pusheados
$ git filter-branch —tree-filter “sed ’s/mipassword//g’ > parameters.temp; mv parameters.temp parameters.yml”
![Page 81: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/81.jpg)
Otros usos
• Documentación: Markdown + Github = WIN
• Blogging: Github Pages
• Git con imagenes: Github images diffing
![Page 82: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/82.jpg)
Otros usos
• Documentación: Markdown + Github = WIN
• Blogging: Github Pages
• Git con imagenes: Github images diffing
![Page 83: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/83.jpg)
Herramientas
• Hub: Wrapper de git para mejorar integración con Github
• Clientes:
• Tower
• SourceTree
• Github client
• gitk
• GitX
• IntelliJ (PHPStorm, PyCharm…)
![Page 84: Mejorando en Git](https://reader034.fdocument.pub/reader034/viewer/2022042509/54925bc0ac7959342e8b45d4/html5/thumbnails/84.jpg)
¿Preguntas?Moltes gràcies :)