fixup!
This commit is contained in:
parent
b7c595f8fd
commit
f3c0af811f
|
@ -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!'."
|
||||
}
|
Loading…
Reference in New Issue