Skip to content

Instantly share code, notes, and snippets.

@whinc
Created June 16, 2022 02:23
Show Gist options
  • Select an option

  • Save whinc/c23d749dcd1bb66fc21590d9bfc12b83 to your computer and use it in GitHub Desktop.

Select an option

Save whinc/c23d749dcd1bb66fc21590d9bfc12b83 to your computer and use it in GitHub Desktop.
print commit messages betweenb the last two commit
#!/usr/bin/env bash
# 获取最近两次发布(通过tag判断)之间的提交记录
MODE="$1"
EXCLUDE=""
if [[ "$MODE" == "prod" ]]; then
EXCLUDE="test@*"
else
EXCLUDE="prod@*"
fi
tagName="$(git describe --tags --exclude "debug@*" --exclude "v*" --exclude "$EXCLUDE" HEAD^1)"
git log --pretty="format:%an | %ar | %s" "${tagName:0:19}"...HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment