Count commits ahead or behind using rugged/libgit2

Viewed 10

The following git command line provides a count of the commits that origin/master is ahead of master (local copy)

git rev-list --count master..origin/master

Output will be 0 if not ahead, or n for the number of additional commits made to origin/master.

How could I get this same information using the rugged gem in a ruby-native fashion?

Rugged documentation and API docs for the underlying libgit2 are really byzantine, and difficult to parse. It's complex stuff, I get it, but I can't find any references to the rev-list command, so I'm not sure where to look.

0 Answers
Related