Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .claude/skills/sync-git/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: sync-git
description: Sync local repo with upstream, clean up branches and remotes
disable-model-invocation: true
allowed-tools: Bash
---

Run `bash scripts/synch-git.sh` and report the output to the user.
25 changes: 25 additions & 0 deletions scripts/synch-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

echo "=== Syncing main with upstream ==="
git fetch upstream main
git checkout main
git merge upstream/main --ff-only

echo ""
echo "=== Pruning stale remote-tracking references ==="
git fetch origin --prune
git fetch upstream --prune

echo ""
echo "=== Deleting local branches merged into main ==="
merged=$(git branch --merged main | grep -v '^\*\|main' || true)
if [ -n "$merged" ]; then
echo "$merged" | xargs git branch -d
else
echo "No merged branches to delete."
fi

echo ""
echo "=== Done ==="
git branch
Loading