Skip to main content

changes.sh

changes.sh - Overview

This script generates a description of changes based on git logs, formatting commit messages and linking issue numbers to a GitHub repository.

Detailed Documentation

The script primarily uses git log to extract commit messages and then formats them using sed.

It also accepts parameters to filter git logs.

Parameters:

  • GHORG: The GitHub organization name. Defaults to hypermodeinc.
  • GHREPO: The GitHub repository name. Defaults to badger.
  • Remaining parameters: Passed directly to git log.

The script first outputs a header describing how it was invoked. It then pipes the output of git log through two sed commands:

  1. sed -E "s/^(\S{7}\s)//g": Removes the first 7 characters (short commit hash) and the following whitespace from each line.
  2. sed -E "s/([\s|\(| ])#([0-9]+)/\1${GHORG}\/${GHREPO}#\2/g": Replaces issue references (e.g., #123) with a link to the GitHub issue in the specified organization and repository (e.g., hypermodeinc/badger#123).

Returns:

The script outputs a formatted list of commit messages to standard output.

Getting Started Relevance: NO