Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GitGot: The Swiss Army Chainsaw of Git Repo Management

1,029 views

Published on

GitGot is a Perl-based tool for batch management of collections of git repos. It has a number of interesting features and acts as a force multiplier when dealing with a large varied collection of repositories. My talk will cover why you would want to use GitGot as well as how to use it effectively.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

GitGot: The Swiss Army Chainsaw of Git Repo Management

  1. 1. GitGot: The Swiss Army Chainsaw of Git Repo Management John SJ Anderson • Infinity Interactive @genehack • OSCON'14
  2. 2. Hi, I'm John.
  3. 3. @genehack
  4. 4. Sammy
  5. 5. @sammygenehack
  6. 6. Two kids
  7. 7. A Wife
  8. 8. long-suffering conference widow A Wife
  9. 9. photobomber is not impressed. long-suffering conference widow A Wife
  10. 10. Job
  11. 11. Hobbies
  12. 12. Hobbies
  13. 13. Hobbies
  14. 14. Lots of Hobbies
  15. 15. I've got a lot of balls in the air
  16. 16. Revision control $HOME
  17. 17. Why bother?
  18. 18. say automation again
  19. 19. Ingy döt Net
  20. 20. Things I wanted to steal
  21. 21. Things I wanted to add
  22. 22. App::AYCABTU?!?!‽
  23. 23. GitGot
  24. 24. Whirlwind Tour
  25. 25. got add
  26. 26. % got add Name: foo URL: Path: /Users/genehack/foo Tags: bar
  27. 27. got add -D
  28. 28. got clone <REPO URL>
  29. 29. got clone -D <REPO URL>
  30. 30. got fork <GITHUB URL>
  31. 31. ~/.gitgot
  32. 32. - name: App-Amylase path: /Users/genehack/proj/App-Amylase repo: git@github.com:genehack/App-Amylase.git type: git - name: Git-Wrapper path: /Users/genehack/proj/Git-Wrapper repo: git@github.com:genehack/Git-Wrapper.git tags: git type: git - name: HiD path: /Users/genehack/proj/HiD repo: git@github.com:genehack/HiD.git type: git - name: Perl-Build path: /opt/plenv/plugins/perl-build repo: git://github.com/tokuhirom/Perl-Build.git type: git
  33. 33. But now what?
  34. 34. got list
  35. 35. got ls
  36. 36. 1) App-Amylase git git@github.com:genehack/App-Amylase.git 2) Git-Wrapper git git@github.com:genehack/Git-Wrapper.git 3) HiD git git@github.com:genehack/HiD.git 4) Perl-Build git git://github.com/tokuhirom/Perl-Build.git 5) Perl-Critic git git@github.com:genehack/Perl-Critic.git 6) STAMPS git git@github.com:genehack/STAMPS.git 7) advanced-moose-class git ssh://git@git.iinteractive.com/train/advanced-moose-class.git 8) app-gitgitr git git@github.com:genehack/app-gitgitr.git 9) app-gitgot git git@github.com:genehack/app-gitgot.git
  37. 37. got ls -q
  38. 38. 1) App-Amylase 2) Git-Wrapper 3) HiD 4) Perl-Build 5) Perl-Critic 6) STAMPS 7) advanced-moose-class 8) app-gitgitr 9) app-gitgot
  39. 39. got ls [repos]
  40. 40. got ls 5
  41. 41. 5) Perl-Critic
  42. 42. got ls 5-8
  43. 43. 5) Perl-Critic 6) STAMPS 7) advanced-moose-class 8) app-gitgitr
  44. 44. got ls HiD
  45. 45. 3) HiD
  46. 46. got ls -t git
  47. 47. 2) Git-Wrapper 8) app-gitgitr 9) app-gitgot
  48. 48. got ls 5-8 HiD 21 -t git
  49. 49. 2) Git-Wrapper 3) HiD 5) Perl-Critic 6) STAMPS 7) advanced-moose-class 8) app-gitgitr 9) app-gitgot 21) etc
  50. 50. got status
  51. 51. got st
  52. 52. 1) App-Amylase : OK 2) Git-Wrapper : OK 3) HiD : OK 4) Perl-Build : OK 5) Perl-Critic : OK 6) STAMPS : OK 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK
  53. 53. 1) App-Amylase : OK 2) Git-Wrapper : OK 3) HiD : Dirty Dirty 4) Perl-Build : OK 5) Perl-Critic : OK 6) STAMPS : OK 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK
  54. 54. 1) App-Amylase : OK 2) Git-Wrapper : OK 3) HiD : OK 4) Perl-Build : Dirty 5) Perl-Critic : OK 6) STAMPS : OK 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK 1) 1) App-App-Amylase Amylase : : OK OK 2) 2) Git-Git-Wrapper Wrapper : : OK OK 3) 3) HiD HiD : : OK OK 4) 4) Perl-Perl-Build Build : : OK OK 5) 5) Perl-Perl-Critic Critic : : OK OK 6) STAMPS STAMPS : : OK OK Ahead by 1 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK
  55. 55. got st -q
  56. 56. 3) HiD : Dirty 6) STAMPS : OK Ahead by 1 got st -q Dirty
  57. 57. got update
  58. 58. got up
  59. 59. 1) App-Amylase : Up to date 2) Git-Wrapper : Up to date 3) HiD : Up to date 4) Perl-Build : Updated Updating 7f25f89..72587c8 Fast-forward lib/Perl/Build.pm | 14 +++++++++++++- script/perl-build | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) 5) Perl-Critic : Up to date
  60. 60. got update_status
  61. 61. got upst
  62. 62. got upst -q
  63. 63. How much would you pay?
  64. 64. Wait, don't answer yet
  65. 65. got fetch
  66. 66. got push
  67. 67. got gc
  68. 68. got this
  69. 69. got that
  70. 70. got chdir
  71. 71. got cd
  72. 72. got tmux
  73. 73. got tmux -s
  74. 74. How much would you pay now
  75. 75. Good news! It's free!
  76. 76. Works on any perl from the last 5 years
  77. 77. cpan App::GitGot
  78. 78. cpanm App::GitGot
  79. 79. Find me at OSCON and I'll help you install!
  80. 80. Easy to extend
  81. 81. package App::GitGot::Command::chdir; # ABSTRACT: open a subshell in a selected project ! use Mouse; extends 'App::GitGot::Command'; use 5.010; ! sub command_names { qw/ chdir cd / } ! sub _execute { my( $self, $opt, $args ) = @_; ! unless ( $self->active_repos and $self->active_repos == 1 ) { say STDERR 'ERROR: You need to select a single repo'; exit(1); } ! my( $repo ) = $self->active_repos; ! chdir $repo->path or say STDERR "ERROR: Failed to chdir to repo ($!)" and exit(1); ! exec $ENV{SHELL}; } ! __PACKAGE__->meta->make_immutable; 1;
  82. 82. package App::GitGot::Command::chdir; # ABSTRACT: open a subshell in a selected project ! use Mouse; extends 'App::GitGot::Command'; use 5.010;
  83. 83. sub command_names { qw/ chdir cd / } !
  84. 84. sub _execute { my( $self, $opt, $args ) = @_; ! unless ( $self->active_repos and $self->active_repos == 1 ) { say STDERR 'ERROR: You need to select a single repo'; exit(1); } ! my( $repo ) = $self->active_repos; ! chdir $repo->path or say STDERR "ERROR: Failed to chdir to repo ($!)" and exit(1); ! exec $ENV{SHELL}; }
  85. 85. package App::GitGot::Command::chdir; # ABSTRACT: open a subshell in a selected project ! use Mouse; extends 'App::GitGot::Command'; use 5.010; ! sub command_names { qw/ chdir cd / } ! sub _execute { my( $self, $opt, $args ) = @_; ! unless ( $self->active_repos and $self->active_repos == 1 ) { say STDERR 'ERROR: You need to select a single repo'; exit(1); } ! my( $repo ) = $self->active_repos; ! chdir $repo->path or say STDERR "ERROR: Failed to chdir to repo ($!)" and exit(1); ! exec $ENV{SHELL}; } ! __PACKAGE__->meta->make_immutable; 1;
  86. 86. Suggestions welcome!
  87. 87. Wait… there's more!
  88. 88. App::MiseEnPlace
  89. 89. % cat .mise --- manage: - doc - etc - private - proj/* - src/* create: directories: - bin - proj - src - var links: - Desktop: var/tmp - Desktop: tmp
  90. 90. create: directories: - ~/.ssh links: - authinfo: ~/.authinfo - bash_private: ~/.bash_private - github-identity: ~/.github-identity - netrc: ~/.netrc - ssh/authorized_keys: ~/.ssh/authorized_keys - ssh/config: ~/.ssh/config - ssh/id_dsa: ~/.ssh/id_dsa - ssh/id_dsa.pub: ~/.ssh/id_dsa.pub - zsh_private: ~/.zsh_private
  91. 91. got
  92. 92. https://github.com/ genehack/app-gitgot
  93. 93. https://github.com/ genehack/app-miseenplace
  94. 94. Thanks Ingy döt Net Yanick Champoux Michael Greb Rolando Pereira Chris Prather
  95. 95. Questions?
  96. 96. https://github.com/genehack/ app-gitgot ! https://github.com/genehack/ app-miseenplace

×