0

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.

Frank Koehl
  • 3,104
  • 2
  • 29
  • 37
  • I think you're looking for https://libgit2.org/libgit2/#HEAD/group/graph/git_graph_ahead_behind. – lrm29 Sep 25 '22 at 15:31

0 Answers0