Problem
You want to display the last commit of every file that you have in a list.
Solution
Let’s say that you have the following file list in an array:
1 |
file_list = ["Gemfile", "Gemfile.lock", ".ruby-version"] |
in order to be able to get the last commits of each of the files in ruby do the following:
1 2 3 |
file_list.each do |f| puts %x[git log -n 1 #{f}] end |