Skip to content

Instantly share code, notes, and snippets.

@cliffano
Last active March 9, 2021 03:53
Show Gist options
  • Save cliffano/04093787a0410646a87584b0e96cfcc6 to your computer and use it in GitHub Desktop.
Save cliffano/04093787a0410646a87584b0e96cfcc6 to your computer and use it in GitHub Desktop.
Utility scripts using repoman
Poor man's quick stats of git logs analysis
===========================================
Retrieve git logs across multiple repositories, then count the number of commits made by any author:
repoman exec 'git log' >> /tmp/gitlog.txt
grep "Author: " /tmp/gitlog.txt | wc -l
Count the commits by author:
grep "Author: " /tmp/gitlog.txt | sort | uniq -c
Retrieve git logs across multiple repositories since a particular timestamp, then count the number of commits made by any author:
repoman exec 'git log --since="2017-09-01T16:36:00-07:00"' >> /tmp/gitlogsince.txt
grep "Author: " /tmp/gitlogsince.txt | wc -l
Managing forks of multiple repos
================================
Fork all repos:
repoman exec 'gh repo fork "<org>/{{{name}}}" --clone=true'
Set upstream of all forks:
repoman exec 'git remote add upstream https://github.com/<org>/{{{name}}}.git'
List all GH secrets
===================
repoman exec 'gh secret list -R github.com/<org>/{{name}}'
Generate Markdown table with GH Actions build badge
===================================================
repoman exec 'echo "| [![{{name}} Build Status](https://github.com/{{org}}/{{name}}/workflows/CI/badge.svg)](https://github.com/{{org}}/{{name}}/actions?query=workflow%3ACI) | {{name}} |"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment