Created
March 14, 2025 18:59
-
-
Save rhaberkorn/8222112f3573ec2b3994ce863066000b to your computer and use it in GitHub Desktop.
Squash changes into the last commit
This file contains hidden or 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/sh | |
# Creates a commit from the given files and automatically | |
# squashes it into the last commit on HEAD. | |
set -e | |
if [ "x`git branch -r --contains HEAD`" != x ]; then | |
echo "HEAD commit already pushed?" | |
exit 1 | |
fi | |
git commit --fixup=HEAD "$@" | |
git rebase --autostash --autosquash HEAD~~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment