shared/models/git_repo.rb
# Return the last commit, that isn't a merge commit
# Make sure to have checked out the right branch for which
# you want to get the last commit of
Return the last commit, that isn't a merge commit
Make sure to have checked out the right branch for which
you want to get the last commit of
Return the last commit that isn ' t a merge commit Make sure to have checked out the right branch for which you want to get the last commit of
def most_recent_commit
      self.git.log.each do |commit|
        return commit unless commit.parents.count >= 2
      end
      return nil
    end
def most_recent_commit self . git . log . each do | commit | return commit unless commit . parents . count >= 2 end return nil end
Return the last commit, that isn't a merge commit
Make sure to have checked out the right branch for which
you want to get the last commit of
Return the last commit that isn ' t a merge commit Make sure to have checked out the right branch for which you want to get the last commit of
# 2 parents only happen on merge commits https://stackoverflow.com/a/3824122