From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

Git::Wrapper::Plus::Ref::Branch - A Branch object

VERSION

version 0.004011

SYNOPSIS

my $branch = Git::Wrapper::Plus::Ref::Branch->new(
git => $git_wrapper,
name => 'master'
);
$branch->refname # refs/heads/master
$branch->sha1 # deadbeefbadf00da55c0ffee
$branch->delete # git branch -d master
$branch->delete({ force => 1 }); # git branch -D master
$branch->move('alternative'); # git branch -m master alternative
$branch->move('alternative', { force => 1 }); # git branch -M master alternative

METHODS

new_from_Ref

Convert a Plus::Ref to a Plus::Ref::Branch

my $branch_object = $class->new_from_Ref( $ref_object );

refname

Returns name, in the form refs/heads/<name>

sha1

Returns the SHA1 of the branch tip.

delete

$branch->delete(); # git branch -d $branch->name
$branch->delete({ force => 1 }); # git branch -D $branch->name

Note: $branch will of course still exist after this step.

move

$branch->move($new_name); # git branch -m $branch->name, $new_name
$branch->move($new_name, { force => 1 }); # git branch -M $branch->name $new_name

Note: $branch will of course, still exist after this step

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.