comparing 2 commits in rugged

I didn’t find any documentation on getting the difference between 2 files in rugged.
I used the below code to commit a file using rugged$reponame)
puts @sha
commit = @repo.lookup(@sha)

how can see the difference between the 2 commits of the same object in rugged?

  • Rugged equivalent to 'git ls-tree'
  • Is the ɴᴜʟ character forbidden in filenames for Git repositories?
  • An error occurred while installing rugged
  • Rugged and Grack: Finding commit before push
  • Rugged: Path and commit_id of tree
  • How to programmatically create a commit with Rugged?
  • rugged is installed but bundler fails to install
  • How do I use rugged to add and commit all files in a repository
  • One Solution collect form web for “comparing 2 commits in rugged”

    The way to compare two commits in git relies on a diffing process.

    brianmario recently wrapped the diffing iterator feature of libgit2. Beware that this feature is not merged yet.

    Below a high level example of its future usage.

    r ='.')
    diff = r.diff(commit1, commit2)
    diff.deltas.each do |delta|
      # ...
      delta.hunks.each do |hunk|
        # ...
        hunk.lines.each do |line|
          # ...

    See this pull request for more information about proposed diff implementation and usage.

    Git Baby is a git and github fan, let's start git clone.