GitGot: The Swiss Army Chainsaw of Git Repo Management

Post on 24-May-2015

287 views 0 download

Tags:

description

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.

Transcript of GitGot: The Swiss Army Chainsaw of Git Repo Management

GitGot: The Swiss Army Chainsaw of Git Repo Management

John SJ Anderson • Infinity Interactive@genehack • OSCON'14

Hi, I'm John.

@genehack

Sammy

@sammygenehack

Two kids

A Wife

long-suffering conference widow

A Wife

photobomber isnot impressed.

A Wife

long-suffering conference widow

Job

Hobbies

Hobbies

Hobbies

Lots of Hobbies

I've got a lot of balls in the air

Revision control $HOME

Why bother?

say automation again

Ingy döt Net

Things I wanted to steal

Things I wanted to add

App::AYCABTU?!?!‽

GitGot

Whirlwind Tour

got add

% got add Name: foo URL: Path: /Users/genehack/foo Tags: bar

got add -D

got clone <REPO URL>

got clone -D <REPO URL>

got fork <GITHUB URL>

~/.gitgot

- 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

But now what?

got list

got ls

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

got ls -q

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

got ls [repos]

got ls 5

5) Perl-Critic

got ls 5-8

5) Perl-Critic 6) STAMPS 7) advanced-moose-class 8) app-gitgitr

got ls HiD

3) HiD

got ls -t git

2) Git-Wrapper 8) app-gitgitr 9) app-gitgot

got ls 5-8 HiD 21 -t git

2) Git-Wrapper 3) HiD 5) Perl-Critic 6) STAMPS 7) advanced-moose-class 8) app-gitgitr 9) app-gitgot 21) etc

got status

got st

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

1) App-Amylase : OK 2) Git-Wrapper : OK 3) HiD : 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

Dirty

1) App-Amylase : OK 2) Git-Wrapper : OK 3) HiD : OK 4) Perl-Build : OK 5) Perl-Critic : OK 6) STAMPS : OK Ahead by 1 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK

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

Dirty

1) App-Amylase : OK 2) Git-Wrapper : OK 3) HiD : OK 4) Perl-Build : OK 5) Perl-Critic : OK 6) STAMPS : OK Ahead by 1 7) advanced-moose-class : OK 8) app-gitgitr : OK 9) app-gitgot : OK

Ahead by 1

got st -q

got st -q 3) HiD : Dirty

6) STAMPS : OK Ahead by 1

Dirty

Ahead by 1

got update

got up

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

Updated

got update_status

got upst

got upst -q

How much would you pay?

Wait, don't answer yet

got fetch

got push

got gc

got this

got that

got chdir

got cd

got tmux

got tmux -s

How much would

you paynow

Good news!

It's free!

Works on any perl from the last 5 years

cpan App::GitGot

cpanm App::GitGot

Find me at OSCON and I'll help you install!

Easy to extend

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;

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 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;

Suggestions welcome!

Wait…there'smore!

App::MiseEnPlace

% cat .mise --- manage: - doc - etc - private - proj/* - src/* create: directories: - bin - proj - src - var links: - Desktop: var/tmp - Desktop: tmp

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

got

https://github.com/genehack/app-gitgot

https://github.com/genehack/app-miseenplace

Thanks Ingy döt Net

Yanick Champoux Michael Greb

Rolando PereiraChris Prather

Questions?

https://github.com/genehack/app-gitgot

!

https://github.com/genehack/app-miseenplace