summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xar/.local/bin/ppts26
1 files changed, 25 insertions, 1 deletions
diff --git a/ar/.local/bin/ppts b/ar/.local/bin/ppts
index 387bcf7..e315367 100755
--- a/ar/.local/bin/ppts
+++ b/ar/.local/bin/ppts
@@ -67,7 +67,31 @@ if [ -z "$1" ]; then
# Step 3: Push to origin (without content/)
echo "Step 3: Pushing to origin (without content/)..."
- git push origin master || exit 1
+ # Temporarily disable pre-push hook since we already excluded content/
+ hook_disabled=false
+ if [ -f .git/hooks/pre-push ]; then
+ mv .git/hooks/pre-push .git/hooks/pre-push.disabled
+ hook_disabled=true
+ fi
+ # Try normal push first
+ if git push origin master 2>/dev/null; then
+ # Push succeeded
+ :
+ else
+ # Push failed, try force push (origin may have diverged)
+ echo "Warning: Origin has diverged, using force push..."
+ git push origin master --force || {
+ # Restore hook if push failed
+ if [ "$hook_disabled" = true ] && [ -f .git/hooks/pre-push.disabled ]; then
+ mv .git/hooks/pre-push.disabled .git/hooks/pre-push
+ fi
+ exit 1
+ }
+ fi
+ # Restore hook after successful push
+ if [ "$hook_disabled" = true ] && [ -f .git/hooks/pre-push.disabled ]; then
+ mv .git/hooks/pre-push.disabled .git/hooks/pre-push
+ fi
echo "✓ Pushed to origin (without content/)"
else
echo "No changes to commit (excluding content/)"