From af0085d31eb6feb3507072c1d81b4d2e4059dab7 Mon Sep 17 00:00:00 2001 From: dzu Date: Sat, 21 Feb 2026 06:18:35 +0000 Subject: [PATCH 1/2] fix: add git identity --- main.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.sh b/main.sh index daf4853..e2c503a 100755 --- a/main.sh +++ b/main.sh @@ -31,6 +31,10 @@ TMP_BRANCH="tmp-$RANDOM" git checkout -b $TMP_BRANCH git checkout $BRANCH +# use current branch last commit's author as the git identity +GIT_NAME=$(git show -s --format='%an' HEAD) +GIT_EMAIL=$(git show -s --format='%ae' HEAD) + # reset current branch to the root ROOT_HASH=$(git rev-list --max-parents=0 HEAD) git reset --hard $ROOT_HASH @@ -38,7 +42,7 @@ git reset --hard $ROOT_HASH # merge-squash newest changes from the temporary branch git merge --squash $TMP_BRANCH git add . -git commit -m "$(date)" +git commit -c user.email=$GIT_EMAIL -c user.name=$GIT_NAME m "$(date)" # remove temporary branch git branch -D $TMP_BRANCH From 7bd8c658ebca48d555c8d56cbea283259a7c5348 Mon Sep 17 00:00:00 2001 From: dzu Date: Sat, 21 Feb 2026 06:18:58 +0000 Subject: [PATCH 2/2] ench: add a message mentioning squashed commits --- main.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.sh b/main.sh index e2c503a..1b01eb5 100755 --- a/main.sh +++ b/main.sh @@ -39,10 +39,17 @@ GIT_EMAIL=$(git show -s --format='%ae' HEAD) ROOT_HASH=$(git rev-list --max-parents=0 HEAD) git reset --hard $ROOT_HASH +# generate changes +MESSAGE='' +for rev in $(git rev-list $ROOT_HASH..$TMP_BRANCH); do + MESSAGE="$(git show --no-color --format=fuller --no-patch HEAD)\n$MESSAGE" +done +MESSAGE="Squashed the branch at $(date)\n$MESSAGE" + # merge-squash newest changes from the temporary branch git merge --squash $TMP_BRANCH git add . -git commit -c user.email=$GIT_EMAIL -c user.name=$GIT_NAME m "$(date)" +git commit -c user.email=$GIT_EMAIL -c user.name=$GIT_NAME -m $MESSAGE # remove temporary branch git branch -D $TMP_BRANCH