diff --git a/LibGit2Sharp/Branch.cs b/LibGit2Sharp/Branch.cs
index dbb1dd9ec..dd2d4fa6c 100644
--- a/LibGit2Sharp/Branch.cs
+++ b/LibGit2Sharp/Branch.cs
@@ -153,6 +153,26 @@ public virtual string UpstreamBranchCanonicalName
}
}
+ ///
+ /// Get the name of the remote for the branch.
+ ///
+ /// If this is a local branch, this will return the configured
+ /// to fetch from and push to. If this is a
+ /// remote-tracking branch, this will return the name of the remote
+ /// containing the tracked branch. If there no tracking information
+ /// this will return null.
+ ///
+ ///
+ public virtual string RemoteName
+ {
+ get
+ {
+ return IsRemote
+ ? RemoteNameFromRemoteTrackingBranch()
+ : RemoteNameFromLocalBranch();
+ }
+ }
+
///
/// Get the remote for the branch.
///
@@ -162,20 +182,12 @@ public virtual string UpstreamBranchCanonicalName
/// the tracked branch.
///
///
+ [Obsolete("This property is deprecated. Use Repository.Network.Remotes[] using the RemoteName property")]
public virtual Remote Remote
{
get
{
- string remoteName;
-
- if (IsRemote)
- {
- remoteName = RemoteNameFromRemoteTrackingBranch();
- }
- else
- {
- remoteName = RemoteNameFromLocalBranch();
- }
+ string remoteName = RemoteName;
if (remoteName == null)
{