---
name: "Git::Raw::Reference"
section: "3pm"
platform: "linux"
package: "libgit-raw-perl"
version: "0.90+ds-3+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Git::Raw::Reference"
---

# Git::Raw::Reference(3pm)

Git reference class

## NAME

Git::Raw::Reference - Git reference class

## VERSION

version 0.90

## DESCRIPTION

A Git::Raw::Reference represents a Git reference.

**WARNING**: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).

## METHODS

### annotated\_commit( )

Create a Git::Raw::AnnotatedCommit from the reference.

### lookup( $name, $repo )

Retrieve the reference with name `$name` in `$repo`.

### create( $name, $repo, $object \[, $force, $symbolic\] )

Creates and returns a new reference named `$name` in `$repo` pointing to `$object`. `$object` can be a Git::Raw::Blob, Git::Raw::Commit, or a Git::Raw::Tree object.  If `$force` is a truthy value, any existing reference is overwritten.  If `$force` is falsy (the default) and a reference named `$name` already exists, an error is thrown. If `$symbolic` is a truthy value, then a symbolic reference is created. If `$symbolic` is falsy (the default), then a direct reference is created. If `$symbolic` is a truthy value, then `$object` can be a Git::Raw::Reference or a string.

### delete( )

Delete the reference. The Git::Raw::Reference object must not be accessed afterwards.

### name( )

Retrieve the name of the reference.

### shorthand( )

Get the reference's short name. This will transform the reference name into a "human-readable" version. If no shortname is appropriate, it will return the full name.

### type( )

Retrieve the type of the reference. Can be either `"direct"` or `"symbolic"`.

### target( \[$new\_target\] )

Retrieve the target of the reference. If the `$new_target` parameter of type Git::Raw::Reference is passed, the reference will be changed to point to it.

Note that updating the target will invalidate all existing handles to the reference.

This function returns either an object (Git::Raw::Blob, Git::Raw::Commit, Git::Raw::Tag or Git::Raw::Tree) for direct references, or another reference for symbolic references.

### peel( $type )

Recursively peel the reference until an object of the specified `$type` is found. Valid values for `$type` include: `"commit"`, `"tree"` or `"tag"`.

### reflog( )

Retrieve the Git::Raw::Reflog of the reference. Shortcut for `"Git::Raw::Reflog->open()"`.

### owner( )

Retrieve the Git::Raw::Repository owning the reference.

### is\_branch( )

Check if the reference is a branch.

### is\_remote( )

Check if the reference is remote.

### is\_tag( )

Check if the reference lives in the `"refs/tags"` namespace.

### is\_note( )

Check if the reference lives in the `"refs/notes"` namespace.

## AUTHOR

Alessandro Ghedini \<alexbio@cpan.org\>

Jacques Germishuys \<jacquesg@cpan.org\>

## LICENSE AND COPYRIGHT

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.
