How do you display the commit content specified with SHA-1 in a Ruby on Rails application?
How to display commit content in ruby
268 Views Asked by Kazimír At
3
There are 3 best solutions below
0
On
There's a good library for this. Include it in your gemfile and look at the docs for how to implement.
0
On
Just use grit:
require 'grit'
repo = Grit::Repo.new(path_to_repo)
repo.commit(sha)
Then just play with the commit object returned. Check out http://grit.rubyforge.com/. If you want to see the changed files by that commit you can do
commit.diffs.each {|d| puts d.a_path || d.b_path }
As a disclaimer I'm not sure if this is an answer to your question but I'll give you what I know:
In the console (folder for your project, obviously), you can get a list of the files you have changed and their status for your upcoming commit with:
To get a readout of the exact code changes, you can type into the console:
Hope that helps!