Created
January 19, 2024 11:50
-
-
Save aztack/9403a6139164d8ca65b334af56897ed1 to your computer and use it in GitHub Desktop.
Recent Commits Log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ancestor_branch=${1:-"origin/develop-sdk"} | |
# Find the latest common ancestor commit | |
joint_commit=$(git merge-base HEAD $ancestor_branch) | |
echo $joint_commit | |
# Get the list of commit hashes from current HEAD to the joint commit | |
commit_hashes=$(git rev-list --ancestry-path ${joint_commit}..HEAD) | |
count=0 | |
# Iterate through the commit hashes and print the short hash and commit message | |
for commit_hash in $commit_hashes; do | |
echo "* $(git log --format='%h - %s' -n 1 $commit_hash)" | |
count=$((count + 1)) | |
done | |
if [ $count -eq 0 ]; then | |
echo "No Commits Found" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment