This commit is contained in:
Your Name 2024-07-25 18:27:45 -04:00
parent b7c595f8fd
commit f3c0af811f
1 changed files with 20 additions and 0 deletions

20
src/squash_fixups.sh Normal file
View File

@ -0,0 +1,20 @@
# /etc/profile.d/squash-fixups.sh
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "This script should be sourced, not executed."
exit 1
fi
# Function to automate squashing and rebasing for commits starting with "fixup!"
squash_fixups() {
# Ensure we are in a git repository
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "Not inside a git repository."
return 1
fi
# Perform a non-interactive rebase with autosquash
git rebase --autosquash --autostash --keep-empty --rebase-merges -i "$(git merge-base HEAD $(git rev-list --no-walk HEAD))" < /dev/null
echo "Rebase and squash completed for commits starting with 'fixup!'."
}