recentCommits function

Future<List<String>> recentCommits({
  1. String? dir,
  2. int count = 10,
  3. String format = '%h %s',
})

Get recent commit log.

Implementation

Future<List<String>> recentCommits({
  String? dir,
  int count = 10,
  String format = '%h %s',
}) async {
  final result = await runGit([
    'log',
    '--oneline',
    '-$count',
    '--format=$format',
  ], workingDirectory: dir);
  if (!result.success) return [];
  return result.output.split('\n').where((l) => l.isNotEmpty).toList();
}