Class GHRef

java.lang.Object
org.kohsuke.github.GHRef

public class GHRef extends Object
Provides information on a Git ref from GitHub.
Author:
Michael Clarke
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The type GHObject.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes this ref from the repository using the GitHub API.
    The object that this ref points to.
    Name of the ref, such as "refs/tags/abc".
    Deprecated.
    For access to the GitHub instance, use a local copy instead of pulling it out of objects.
    The API URL of this tag, such as https://api.github.com/repos/jenkinsci/jenkins/git/refs/tags/1.312
    void
    Updates this ref to the specified commit.
    void
    updateTo(String sha, Boolean force)
    Updates this ref to the specified commit.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GHRef

      public GHRef()
  • Method Details

    • getRef

      public String getRef()
      Name of the ref, such as "refs/tags/abc".
      Returns:
      the ref
    • getUrl

      public URL getUrl()
      The API URL of this tag, such as https://api.github.com/repos/jenkinsci/jenkins/git/refs/tags/1.312
      Returns:
      the url
    • getObject

      public GHRef.GHObject getObject()
      The object that this ref points to.
      Returns:
      the object
    • updateTo

      public void updateTo(String sha) throws IOException
      Updates this ref to the specified commit.
      Parameters:
      sha - The SHA1 value to set this reference to
      Throws:
      IOException - the io exception
    • updateTo

      public void updateTo(String sha, Boolean force) throws IOException
      Updates this ref to the specified commit.
      Parameters:
      sha - The SHA1 value to set this reference to
      force - Whether or not to force this ref update.
      Throws:
      IOException - the io exception
    • delete

      public void delete() throws IOException
      Deletes this ref from the repository using the GitHub API.
      Throws:
      IOException - the io exception
    • getRoot

      @Deprecated public GitHub getRoot()
      Deprecated.
      For access to the GitHub instance, use a local copy instead of pulling it out of objects.
      Get the root GitHub instance for this object.
      Returns:
      the root GitHub instance