From bd1d33a15760dbf496a3a5214b95ead336703ea6 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 27 Feb 2026 19:40:28 +0100 Subject: [PATCH] fix(husky): aggressively intercept tag push and silence expected error --- .husky/pre-push | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 07cb74d..23df0c8 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -30,9 +30,19 @@ do git tag -f "$TAG" > /dev/null echo "✅ Tag $TAG has been updated locally with synced versions." - echo "🚀 Proceeding with push..." + # Push branch AND tag directly inside the hook because Git native push has already recorded the old SHA + CURRENT_BRANCH=$(git branch --show-current) + if [ -n "$CURRENT_BRANCH" ]; then + git push origin "$CURRENT_BRANCH" --no-verify + fi + git push origin "$TAG" --force --no-verify - exit 0 + echo -e "\n\033[32m✨ VERSIONS SYNCED & PUSHED SUCCESSFULLY ✨\033[0m" + echo -e "\033[33mThe correct commit has been tagged on origin.\033[0m" + echo -e "\033[90m(Info: You will see a 'pre-push hook failed' and 'failed to push' error below. Please completely ignore it. We MUST abort the native git push, otherwise Git would push the pre-sync commit to the tag and break the version history.)\033[0m\n" + + # We MUST exit 1, otherwise native Git will push the wrong commit to the tag + exit 1 else echo "✨ Versions already in sync for $TAG." exit 0