Skip to content

Instantly share code, notes, and snippets.

@paulscott
Last active January 24, 2019 19:29
Show Gist options
  • Save paulscott/8a67b88f621985260e8a41d105958633 to your computer and use it in GitHub Desktop.
Save paulscott/8a67b88f621985260e8a41d105958633 to your computer and use it in GitHub Desktop.
generate a very simple changelog between the current branch and it's build branch, or other named branch
#!/bin/bash
# gives a changelog from the last build branch to the feature branch
currentBranch=$(git rev-parse --abbrev-ref HEAD)
currentBranch=${currentBranch#"build/"}
buildBranch="build/${currentBranch}"
# if no args, $buildBranch..$currentBranch
# if one arg, $1..$currentBranch
# if twho args, $1..$2
fromBranch=${1-$buildBranch}
toBranch=${2-$currentBranch}
fromType=$([ -z "${1}" ] && echo 'build branch' || echo '')
echo "Change log from ${fromType} ${fromBranch} to ${toBranch}:"
git log --pretty='format:- %s (%aN)' "${fromBranch}..${toBranch}"
@paulscott
Copy link
Author

Added a header note to the log, so we know what we're looking at.

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