Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created February 19, 2023 20:16
Show Gist options
  • Select an option

  • Save KyMidd/43592e449fc0ff607f6e1d22f15f6cc5 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/43592e449fc0ff607f6e1d22f15f6cc5 to your computer and use it in GitHub Desktop.
# Find current branch name
CURRENT_BRANCH=$(git branch | grep ^\* | cut -d "*" -f 2 | cut -d " " -f 2)
# Find hash of commit most common ancestor, e.g. where branch began
BRANCH_MERGE_BASE=$(git merge-base ${BASE_BRANCH} ${CURRENT_BRANCH})
# Find all commits since common ancestor
BRANCH_COMMITS=$(git rev-list ${BRANCH_MERGE_BASE}..HEAD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment