Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use Git::Wrapper;
use Time::Piece;
my ( $remote_repo, $remote_branch ) = @ARGV;
die "Usage: $0 <remote_repo> <remote_branch>"
unless $remote_repo;
$remote_branch //= 'master';
my $local_branch;
if ( $remote_repo =~ m{github\.com/([^/]+)/} ) {
$local_branch = "review/$1-$remote_branch";
else {
my $time = localtime->datetime;
$time =~ tr[:][-];
$local_branch = "review/$time";
my $git = Git::Wrapper->new(".");
$git->fetch( $remote_repo, $remote_branch );
$git->branch( $local_branch, 'FETCH_HEAD' );
say "Fetched $remote_repo $remote_branch -> $local_branch";
# vim: ts=4 sts=4 sw=4 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.