Following the inspiration of @VonC, I developed this script:
(brew install git-filter-repo
is necessary)
#!/bin/bash
# Create a temporary file to store the commit messages
temp_file=$(mktemp)
main_head_hash=$(git rev-parse main)
suffix="⚠️ rebased since!"
# Use git log to get the commit messages and save them in the temporary file
git log --pretty=format:%s $main_head_hash.. | grep -v $suffix | grep '🚀 build version' > $temp_file
# Create a file to store the replacements
echo > replacements.txt
# Iterate through the commit messages in the temporary file
while read commit_message; do
# Write the replacement message to the replacements.txt file
echo "$commit_message==>$commit_message $suffix" >> replacements.txt
done < $temp_file
# ⚠️⚠️ Rewriting history ⚠️⚠️
git filter-repo --replace-message replacements.txt --force
# Clean up the temporary files
rm $temp_file
rm replacements.txt
(This script was developed with the assistance of chatGPT, providing clear instructions for scripting. I am mindful of the temporary ban policy of chatGPT and ensure this response does not violate any rules as it is the result of trial and error based on a conversation. The script has been tested and proven to work, aiming to aid others in similar tasks)
https://i.sstatic.net/ipAdZ.png