home/git: add git-fixup-fixup script
This commit is contained in:
14
home/programs/git/scripts/git-fixup-fixup.sh
Normal file
14
home/programs/git/scripts/git-fixup-fixup.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
if [ -n "${1:-}" ]; then
|
||||
TARGET_COMMIT="$1"
|
||||
shift
|
||||
else
|
||||
TARGET_COMMIT="HEAD"
|
||||
fi
|
||||
|
||||
COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s' "$TARGET_COMMIT")
|
||||
|
||||
if [[ $COMMIT_MESSAGE =~ ^fixup!* ]]; then
|
||||
git commit -m "$COMMIT_MESSAGE" "$@"
|
||||
else
|
||||
git commit --fixup "$TARGET_COMMIT" "$@"
|
||||
fi
|
||||
Reference in New Issue
Block a user