git-sync-manager-5-safe-branch-operations
Sub-skill of git-sync-manager: 5. Safe Branch Operations.
Best use case
git-sync-manager-5-safe-branch-operations is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of git-sync-manager: 5. Safe Branch Operations.
Teams using git-sync-manager-5-safe-branch-operations should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/5-safe-branch-operations/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How git-sync-manager-5-safe-branch-operations Compares
| Feature / Agent | git-sync-manager-5-safe-branch-operations | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of git-sync-manager: 5. Safe Branch Operations.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 5. Safe Branch Operations
## 5. Safe Branch Operations
Switch branches safely across repositories:
```bash
#!/bin/bash
# ABOUTME: Safe branch switching across repositories
# ABOUTME: Validates branch existence and checks for uncommitted changes
switch_branch() {
local repo="$1"
local target_branch="$2"
if [[ ! -d "$repo/.git" ]]; then
echo "skip: not a git repo"
return 1
fi
cd "$repo" || return 1
# Check for uncommitted changes
if ! git diff --quiet 2>/dev/null || ! git diff --cached --quiet 2>/dev/null; then
echo "blocked: uncommitted changes"
return 1
fi
# Check if branch exists locally
if git show-ref --verify --quiet "refs/heads/$target_branch" 2>/dev/null; then
git checkout "$target_branch" 2>/dev/null
echo "switched: local branch"
return 0
fi
# Check if branch exists remotely
if git show-ref --verify --quiet "refs/remotes/origin/$target_branch" 2>/dev/null; then
git checkout -b "$target_branch" "origin/$target_branch" 2>/dev/null
echo "switched: created from remote"
return 0
fi
echo "skip: branch not found"
return 1
}
# Batch branch switch
batch_switch_branch() {
local target_branch="$1"
shift
local repos=("$@")
echo "Switching to branch: $target_branch"
echo ""
for repo in "${repos[@]}"; do
echo -n "→ $repo: "
switch_branch "$repo" "$target_branch"
done
}
```Related Skills
memory-bridge-operations
Operate and recover the Hermes-to-repo memory bridge: drift checks, quality gate, bridge commits, push verification, and stash recovery when pre-bridge scripts fail after generating outputs.
marine-safety-incidents
Collect, analyze, and report marine safety incident data from 7 global maritime authorities. Use for incident scraping, safety trend analysis, risk assessment, geographic hotspot identification, and marine safety reporting.
worktree-branch-sync-hygiene
Class-level branch, worktree, dirty-main, stash, sync, and hook hygiene for workspace-hub style multi-repo work.
repo-sync
Smart repository synchronization across workspace-hub ecosystem — diagnoses and fixes pull failures (detached HEAD, diverged branches, uncommitted changes)
nested-git-repo-stash-safety
How to safely stash changes in a parent repo containing dirty nested git repositories
multi-repo-sync-diagnosis-repair
Diagnose and repair failed pulls across multi-repo ecosystems with stale locks, submodule conflicts, and untracked files
multi-repo-sync-diagnosis-and-repair
Systematic approach to diagnosing and repairing failures across a multi-repo workspace
multi-repo-branch-hygiene-at-scale
Systematic approach to cleaning stale branches, resolving merge conflicts, and syncing multiple repos
git-worktree-cleanup-and-branch-reconciliation
Systematic process for cleaning up stale git worktrees, resolving merge conflicts in diverged branches, and reconciling branch state across multiple repositories.
git-worktree-cleanup-and-branch-hygiene
Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos
workspace-hub-sync-root-churn-catchup
Catch up workspace-hub root changes that continue to appear during repo sync because live review/agent processes keep writing files after commits
workspace-hub-sync-concurrent-writer-blocks
Handle repository_sync cleanup when workspace-hub root is being mutated by concurrent Codex/Codex/Gemini sessions.