Skip to content

Instantly share code, notes, and snippets.

@MaxAtoms
Created November 13, 2021 08:53
Show Gist options
  • Save MaxAtoms/2586ee55c017c56db698a939220717a1 to your computer and use it in GitHub Desktop.
Save MaxAtoms/2586ee55c017c56db698a939220717a1 to your computer and use it in GitHub Desktop.
Git Repos Year-in-review

Git Repos Year-in-review

The following commands and tools can be used to create metrics and visualizations to highlight the work done in the past year.

Number of commits added to the master branch since the start of the year

git rev-list \
--since 2021-01-01 \
--count master

Lines added and removed

git log \
--all \
--no-merges \
--numstat \
--pretty="%H" \
--since=2021-01-01 \
| awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d, plus, minus)}'

Collecting metrics for multiple repos

The above commands can be executed with a tool like MyRepos within multiple repositories. This allows for faster metrics collection.

Creating a video showing the changes in the past year

Gource is a tool that visualizes the file structure of a repository as a tree. It animates commits as changes to that tree over time.

Take a look at the resulting animation first: gource --seconds-per-day .5 -1280x720

A video clip can be created with ffmpeg:

gource --title "Project Title" \
--logo "PathToLogo.png" \
--background ffffff \
--start-date "2021-01-01" \
--seconds-per-day .5 -1280x720 -o gource.ppm
ffmpeg -y -r 60 -f image2pipe -vcodec ppm \
-i gource.ppm -vcodec libx264 -preset fast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 \
gource.mp4

-crf and -preset values can be adapted to tweak transcoding speed as well as the resulting file size (see the Gource Wiki).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment