Skip to content

Instantly share code, notes, and snippets.

@Najki
Created January 20, 2022 13:30
Show Gist options
  • Save Najki/c91e715af6d3197d3620b52c9fc00016 to your computer and use it in GitHub Desktop.
Save Najki/c91e715af6d3197d3620b52c9fc00016 to your computer and use it in GitHub Desktop.
Display a list of commit titles between two revisions in Git
Example output:
❯ git-diff-log 5583981737b4c05ca429b3f62dd0023479c75fde
* Add verbosity and non-verbosity to command output cd328f1
* Share HTTP request error handling between conversion currency methods 5d6e795
* Add error handling to FIAT currency converter after NBP API issues 5fd68e4
* Remove unused get_current_coinbase_rate function 449b971
* Define return types for methods in Wallet class eb6c67a
#!/bin/bash
set -euo pipefail
if [ $# -eq 2 ]; then
BRANCH_CURRENT=$2
elif [ $# -eq 1 ]; then
BRANCH_CURRENT="HEAD"
else
echo " Usage:"
echo " $0 <base branch/revision> <OPTIONAL: current branch/revision>"
exit 1
fi
BRANCH_BASE=$1
git --no-pager log --oneline --no-merges --no-decorate $BRANCH_BASE..$BRANCH_CURRENT | sed -E 's/^([0-9a-z]+) (.+)/* \2 \1/g' | tac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment