Git::Raw::Reflog(3pm)

πŸ’– Git::Raw::Reflog β€” the Git reflog class, bestie edition πŸ’–

okay so. this is Git::Raw::Reflog, a Perl module from the Git::Raw family, and it's literally the reflog but make it Perl. no cap.

VERSION: version 0.90 ✨


🌸 SYNOPSIS 🌸

here's the whole vibe, copy-paste ready:

use Git::Raw;

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

# get the master branch
my $master = Git::Raw::Branch -> lookup($repo, 'master', 1);

# retrieve the reflog for 'master'
my $reflog = $master -> reflog;

# print out reflog information
my @entries = $reflog -> entries;
foreach my $entry (@entries) {
    my $committer = $entry -> committer;
    print "Committer:", "\n";
    print "\t", "Name:   ", $committer -> name, "\n";
    print "\t", "E-Mail  ", $committer -> email, "\n";
    print "\t", "Time:   ", $committer -> time, "\n";
    print "\t", "Offset: ", $committer -> offset, "\n";
    print "\n";

    print "Message: ", $entry -> message, "\n";
    print "Old id:  ", $entry -> old_id, "\n";
    print "New id:  ", $entry -> new_id, "\n";
}

# add a new entry to the reflog
my $signature = Git::Raw::Signature -> default($repo);
$reflog -> append("Hello", $signature);
$reflog -> write;

# drop an entry from the reflog
$reflog -> drop(0);
$reflog -> write;

# remove the reflog
$reflog -> delete;
$reflog -> write;

like… that's the whole arc. open a repo, grab a branch, get its reflog, read every entry, append one, drop one, delete the whole thing. character development fr fr. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

A Git::Raw::Reflog represents a Git reflog. that's the tea. β˜•

⚠️ WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog). πŸ’€ so like, don't build your whole personality on it staying put. it will be documented if it shifts, but it will shift. iykyk.

✨ METHODS ✨

open( $reference )

Open the reflog for the reference $reference. that's it, that's the method β€” you point at a reference, it hands you its reflog. 🫢

delete( )

Delete the reflog for the reference. gone. not me being dramatic, it's literally deleted. πŸ™ˆ

append( $message [, $signature])

Add a new entry to the reflog. If $signature is not provided, the default signature, Git::Raw::Signature->default(), will be used. so you can pass one, but if you don't, it's got you. πŸ’…

drop( $index )

Remove entry $index from the reflog. bye to that one specific entry bestie. πŸŽ€

write( )

Write the reflog back to disk. commit to the bit β€” nothing sticks until you do this. πŸ”₯

entry_count( )

Retrieve the number of entries in the reflog. a little count, a little vibe check. πŸ”’

entries( [$index, $count] )

Retrieve a list of Git::Raw::Reflog::Entry objects. and yes you can slice it up with $index and $count if you only want a lil range of them. ✨


πŸ‘‘ AUTHOR πŸ‘‘

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

actual icons, both of them.


Copyright 2014 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.


okay that's the whole page!! and one last lil sign-off from the footer: this was documented for perl v5.42.3 and dated 2026-08-19 β€” so if you're reading this from the future, hi, hope the reflog is reflogging. πŸ§šπŸ’œ mwah, go write some code. ⭐

πŸ“¦ where this page comes from