Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the files changed in a commit using Rugged?

Tags:

ruby

rugged

I am planning to use Rugged for programmatically accessing Git repositories.

I need to find out the files changed in a specific commit.

Commit object provides the following, according to the documentation.

  • message
  • time
  • author
  • tree
  • parents

I tried the "tree" route, but could not succeed.

I see a similar question asked in SO, in relation to Grit. But, I would like to use Rugged.

In ruby/grit, how do I get a list of files changed in a specific commit?

like image 379
Geordee Naliyath Avatar asked Oct 19 '25 01:10

Geordee Naliyath


1 Answers

You can use Rugged::Commit#diff to get the changes between the commit and its first parent or another Rugged::Commit or Rugged::Tree.

like image 181
Arthur Schreiber Avatar answered Oct 22 '25 05:10

Arthur Schreiber