Summary
Represents a Git reference name in both its canonical (
refs/heads/main) and friendly (main) forms.- Assembly
- GitVersion
.Core .dll - Namespace
- GitVersion
.Git - Interfaces
-
- IEquatable
<ReferenceName> - IComparable
<ReferenceName>
- IEquatable
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IEquatable<ReferenceName>"]
Type-.->Interface1["IComparable<ReferenceName>"]
Type["ReferenceName"]
class Type type-node
Syntax
public sealed class ReferenceName : IEquatable<ReferenceName>, IComparable<ReferenceName>
Attributes
| Type | Description |
|---|---|
| Nullable |
|
| NullableAttribute |
Constructors
| Name | Summary |
|---|---|
| ReferenceName | Initializes a new ReferenceName from its canonical form. |
Fields
| Name | Constant Value | Summary |
|---|---|---|
| LocalBranchPrefix | refs/heads/ |
The canonical prefix for local branches.
static
|
| Remote |
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. |
| WithoutRemote | string |
Gets the friendly name with the remote name removed for remote-tracking branches.
|
Methods
| Name | Value | Summary |
|---|---|---|
| CompareTo |
int |
Compares this instance to other by canonical name.
|
| Equals |
bool | |
| Equals |
bool |
Returns
true when the canonical name of this instance equals that of other. |
| EquivalentTo |
bool |
Returns
true when name matches any of the canonical, friendly, or origin-stripped forms of this reference. |
| FromBranchName |
ReferenceName |
Creates a
ReferenceName from a branch name, automatically prepending the local-branch prefix when necessary.static
|
| FromTagName |
ReferenceName |
Creates a
ReferenceName from a literal tag name, always prepending refs/tags/.static
|
| GetHashCode |
int |
Returns a hash code based on the canonical name.
|
| Parse |
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 != |
bool | |
| operator |
bool | |
| operator |
bool | |
| operator == |
bool | |
| operator > |
bool | |
| operator > |
bool |
Extension Methods
| Name | Value | Summary |
|---|---|---|
| NotNull |
T |
Throws
System.ArgumentNullException when value is null; otherwise returns the value.From CommonExtensions
|
| Try |
bool | |
| Try |
bool |