Git::Raw::Branch(3pm)

๐Ÿ’– Git::Raw::Branch โ€” the branch class, bestie ๐Ÿ’–

okay so this is the page for Git::Raw::Branch(3pm) from the User Contributed Perl Documentation, and I'm gonna walk you through it like we're texting at 2am. stay with me, it's actually so good.


โœจ NAME โœจ

Git::Raw::Branch โ€” it's the Git branch class, periodt. ๐ŸŒธ

๐ŸŒˆ VERSION ๐ŸŒˆ

version 0.90 โ€” yes she's got a number and yes she's proud of it ๐Ÿ’…

โญ SYNOPSIS โญ

okay first of all, look at her:

use Git::Raw;

# open the Git repository at $path
my $repo = Git::Raw::Repository -> open($path);

# create a new branch named 'some_branch'
$repo -> branch('some_branch', $repo -> head -> target);

so you use Git::Raw, you open the repo at $path, and then boom โ€” you make a new branch called 'some_branch' by pointing it at $repo -> head -> target. that's it. that's the whole vibe. ๐Ÿฆ‹

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

She's a helper class for branch manipulation, and here's the iconic part: a Git branch is literally nothing more than a Git::Raw::Reference, so this class inherits all methods from it. like, all of them. she's got the family genes. ๐Ÿ‘‘

WARNING ๐Ÿšจ the API of this module is unstable and may change without warning. (any change will be appropriately documented in the changelog, bestie โ€” they're not gonna ghost you, it's fine.) but fr fr, don't build your whole personality on it staying the same.

๐Ÿ’œ METHODS ๐Ÿ’œ

๐ŸŒธ create( $repo, $name, $target )

Create a new branch, given a name and a target object. And that target has to be either a Git::Raw::Commit or a Git::Raw::Tag โ€” no substitutions, iykyk. โœจ

๐Ÿฆ‹ lookup( $repo, $name, $is_local )

Retrieve the branch that corresponds to the branch name you passed in. ๐ŸŽ€

๐Ÿ’… move( $name, $force )

Rename the branch to $name. okay but here's the tea she wants you to know: in order to get the updated branch object, you need an additional Git::Raw::Branch->lookup(). she doesn't just hand it to you, you gotta go get it yourself. ๐Ÿ™ˆ

๐Ÿ‘‘ upstream( [$upstream] )

Retrieve or set the reference supporting the remote tracking branch, given the local branch. if there's no corresponding supporting reference, this function returns undef โ€” she's not gonna pretend. ๐Ÿ˜ญ

$upstream can be one of three things:

  • a Git::Raw::Reference
  • a string containing the upstream reference name
  • undef

and if you set $upstream to undef? the remote tracking branch association is removed. gone. deleted. no notes. ๐Ÿ’€

๐ŸŒˆ upstream_name( )

Return the name of the reference supporting the remote tracking branch, given the the local branch. (yes, the doubled "the the" is in the original and I love her for it, no cap.) if there's no associated remote tracking branch, this returns undef. ๐Ÿ’–

๐Ÿ“ remote_name( )

Return the name of the remote that the remote tracking branch belongs to, given the local branch. if there's no associated remote tracking branch, this returns undef. same energy, different question. ๐Ÿงš

โญ is_head( )

Check if the current local branch is pointed at by HEAD. the main character check. the vibe check. ๐Ÿ‘‘


๐Ÿ’– AUTHOR ๐Ÿ’–

  • Alessandro Ghedini <alexbio@cpan.org>
  • Jacques Germishuys <jacquesg@cpan.org>

two legends, we stan ๐Ÿซถ

Copyright 2012 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.


and that's the whole page bestie, we ate and left no crumbs ๐ŸŒธ๐Ÿ’…โœจ

this was Git::Raw::Branch(3pm) โ€” perl v5.42.3, dated 2026-08-19. signing off, go make some branches, mwah ๐Ÿ’œ๐Ÿ”ฎ๐ŸŒˆ

๐Ÿ“ฆ where this page comes from