ReferenceName Class

Summary

Represents a Git reference name in both its canonical (refs/heads/main) and friendly (main) forms.
Namespace
GitVersion.Git
Interfaces
Base Types
graph BT Type-->Base0["IEquatable<ReferenceName>"] Type-.->Interface0["IComparable<ReferenceName>"] Type["ReferenceName"] class Type type-node

Syntax

public sealed class ReferenceName : IEquatable<ReferenceName>, IComparable<ReferenceName>

Constructors

Name Summary
ReferenceName(string) Initializes a new ReferenceName from its canonical form.

Fields

Name Constant Value Summary
LocalBranchPrefix refs/heads/
The canonical prefix for local branches.
static
RemoteTrackingBranchPrefix refs/remotes/
The canonical prefix for remote-tracking branches.
static

Properties

Name Value Summary
Canonical string
Gets the canonical reference name (e.g. refs/heads/main).
Friendly string
Gets the shortened, human-readable reference name (e.g. main or origin/main).
IsLocalBranch bool
Gets a value indicating whether this is a local branch reference.
IsPullRequest bool
Gets a value indicating whether this reference corresponds to a pull request.
IsRemoteBranch bool
Gets a value indicating whether this is a remote-tracking branch reference.
IsTag bool
Gets a value indicating whether this is a tag reference.
WithoutOrigin string
Gets the friendly name with the origin/ prefix removed for remote-tracking branches.

Methods

Name Value Summary
CompareTo(ReferenceName) int
Compares this instance to other by canonical name.
Equals(object) bool
Returns true when obj is a ReferenceName with the same canonical name.
Equals(ReferenceName) bool
Returns true when the canonical name of this instance equals that of other.
EquivalentTo(string) bool
Returns true when name matches any of the canonical, friendly, or origin-stripped forms of this reference.
FromBranchName(string) ReferenceName
Creates a ReferenceName from a branch name, automatically prepending the local-branch prefix when necessary.
static
GetHashCode() int
Returns a hash code based on the canonical name.
Parse(string) ReferenceName
Parses canonicalName as a canonical Git reference name, throwing when the input is not a valid canonical form.
static
ToString() string
Returns the friendly (shortened) name of this reference.

Operators

Name Value Summary
operator !=(ReferenceName, ReferenceName) bool
operator <(ReferenceName, ReferenceName) bool
operator <=(ReferenceName, ReferenceName) bool
operator ==(ReferenceName, ReferenceName) bool
operator >(ReferenceName, ReferenceName) bool
operator >=(ReferenceName, ReferenceName) bool

Extension Methods

Name Value Summary
NotNull<ReferenceName>(string) T
Throws ArgumentNullException when value is null; otherwise returns the value.
GitHub