Git::Helpers - Shortcuts for common Git commands
version 0.000006
use Git::Helpers qw( checkout_root remote_url); my $root = checkout_root(); my $remote_url = remote_url('upstream'); my $https_remote_url = https_remote_url(); my $travis_url = travis_url();
Gives you the root level of the git checkout which you are currently in. Optionally accepts a directory parameter. If you provide the directory parameter, checkout_root will temporarily chdir to this directory and find the top level of the repository.
checkout_root
chdir
This method will throw an exception if it cannot find a git repository at the directory provided.
This is a browser-friendly URL for the remote, fixed up in such a way that GitHub (hopefully) doesn't need to redirect your URL.
Turns git@github.com:oalders/git-helpers.git into https://github.com/oalders/git-helpers
Turns https://github.com/oalders/git-helpers.git into https://github.com/oalders/git-helpers
Defaults to using origin as the remote if none is supplied.
origin
Returns a URL for the upstream you've requested by name. Defaults to 'origin'. Provides you with the exact URL which git returns. Nothing is fixed up for you.
# defaults to 'origin' my $remote_url = remote_url(); # $remote_url is now possibly something like one of the following: # git@github.com:oalders/git-helpers.git # https://github.com/oalders/git-helpers.git # get URL for upstream remote my $remote_url = remote_url('upstream');
Returns a travis-ci.org URL for the upstream you've requested by name. Defaults to 'origin'.
# get Travis URL for remote named "origin" my $origin_travis_url = travis_url(); # get Travis URL for remote named "upstream" my $upstream_travis_url = travis_url('upstream');
Olaf Alders <olaf@wundercounter.com>
This software is copyright (c) 2015 by Olaf Alders.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Git::Helpers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Helpers
CPAN shell
perl -MCPAN -e shell install Git::Helpers
For more information on module installation, please visit the detailed CPAN module installation guide.