The GHCompare class provides information about the comparison between two Git references (e.g., branches, tags, or specific SHAs). It allows you to determine the relationship status between the references, the number of commits ahead or behind, and the specific files and commits that differ.
Comparison Status
You can check the getStatus() method to see the relationship between the two references:
ahead: The base is behind the head.behind: The base is ahead of the head.diverged: The references have diverged.identical: The references are the same.
Retrieving Files and Commits
- Files: Use
getFiles() to get an array of GHCommit.File objects that have changed. Note that this array is typically limited to 300 results. For a complete list, you should iterate through the commits and call listFiles() on each. - Commits: Use
getCommits() for a limited array (up to 250) or listCommits() for a paginated view of all commits in the comparison.