Skip to main content Skills Marktplatz Entdecken und erkunden Sie KI-Skills, die von der Community erstellt wurden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Prompt kopierenPrompt-Details anzeigen Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
npx skills add https://github.com/vamseeachanta/workspace-hub --skill git-sync-managerDer Befehl bleibt in einer Zeile. Scrollen Sie horizontal, um ihn vor dem Kopieren vollständig zu prüfen.
Sie bevorzugen eine lokale Kopie? Laden Sie die Dateien herunter, die SkillsMP derzeit vorliegen.
ZIP herunterladen Herunterladen... Mehr aus diesem Repository Write outbound email and external messages in Vamsee Achanta's voice — a subtle offer to help, never bold or rash claims. Load before drafting ANY email, LinkedIn/Collide reply, proposal note, or outreach sent under his name.
Save/publish analysis or computation results from ANY ecosystem repo to Hugging Face as a queryable, viewer-renderable dataset. Use when the user wants to "save results to hugging face", "publish dataset to HF", "hugging face data saving", "save analysis results", "hf dataset", "make results queryable", or "render via datasets-server API". Reshapes nested results into flat parquet tables, writes a dataset card with a viewer `configs:` block and provenance, applies license/public-vs-private routing, enforces a domain data-quality gate (faithful-to-source != correct), publishes to `aceengineer/<repo>-<projection>`, and verifies via the datasets-server API.
Clone, create, fork, configure, and manage GitHub repositories. Manage remotes, secrets, releases, and workflows. Works with gh CLI or falls back to git + GitHub REST API via curl.
Verwandte Berufe SOC
Basierend auf der SOC-Berufsklassifikation
name git-sync-manager version 1.0.0 description Multi-repository git synchronization patterns for batch operations author workspace-hub category bash tags ["bash","git","sync","multi-repo","batch","automation"] platforms ["linux","macos"]
Git Sync Manager
Patterns for synchronizing multiple Git repositories with phased operations, status tracking, and error handling. Extracted from workspace-hub's repository sync scripts.
When to Use This Skill
✅ Use when:
Managing multiple Git repositories from a central location
Performing batch git operations (pull, commit, push)
Need consistent sync workflows across many repos
Automating daily/periodic repository synchronization
Building repository management CLIs
❌ Avoid when:
Single repository operations
Complex merge/rebase workflows requiring manual intervention
Repositories with conflicting changes that need resolution
Core Capabilities
1. Repository Discovery from .gitignore
Automatically discover repositories listed in .gitignore:
#!/bin/bash
WORKSPACE_ROOT="${1:-.} "
discover_repos () {
local repos=()
while IFS= read -r line; do
[[ "$line " =~ ^[[:space:]]*# ]] && continue
[[ -z "$line " ]] && continue
local repo_name="${line%%/*} "
[[ -z "$repo_name " ]] && continue
if [[ -d "$WORKSPACE_ROOT /$repo_name /.git" ]]; then
repos+=("$repo_name " )
fi
done < <(grep -v "^[[:space:]]*#" "$WORKSPACE_ROOT /.gitignore" | grep "/" | head -100)
printf '%s\n' "${repos[@]} "
}
REPOS=($(discover_repos))
echo "Found ${#REPOS[@]} repositories"
2. Multi-Phase Sync Pattern
Execute git operations in ordered phases:
#!/bin/bash
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
SUCCESS=0
FAILED=0
SKIPPED=0
phase_pull () {
local repos=("$@ " )
echo -e "${CYAN} PHASE 1: Pulling latest changes${NC} "
echo -e "${CYAN} ─────────────────────────────────${NC} "
for repo in "${repos[@]} " ; do
if [[ -d "$repo /.git" ]]; then
echo -n "→ Pulling $repo ... "
local branch
branch=$(cd "$repo " && git rev-parse --abbrev-ref HEAD 2>/dev/null)
if (cd "$repo " && git pull origin "$branch " 2>&1 | grep -qE );
-e
((SUCCESS++))
( && git pull origin &>/dev/null);
-e
((SUCCESS++))
-e
((SKIPPED++))
}
() {
repos=( )
message=
-e
-e
repo ;
[[ -d ]];
has_changes=
! ( && git diff --quiet 2>/dev/null);
has_changes=
! ( && git diff --cached --quiet 2>/dev/null);
has_changes=
[[ == ]];
-n
( && git add -A && git commit -m --no-verify 2>/dev/null);
-e
((SUCCESS++))
-e
((SKIPPED++))
-e
((SKIPPED++))
}
() {
repos=( )
-e
-e
repo ;
[[ -d ]];
branch
branch=$( && git rev-parse --abbrev-ref HEAD 2>/dev/null)
-n
( && git push origin 2>&1 | grep -qE );
-e
((SUCCESS++))
( && git push origin &>/dev/null);
-e
((SUCCESS++))
-e
((FAILED++))
}
() {
repos=( )
phase_pull
phase_commit
phase_push
-e
-e
-e
-e
-e
-e
-e
}
3. Repository Status Check
Get detailed status for multiple repositories:
#!/bin/bash
check_repo_status () {
local repo="$1 "
if [[ ! -d "$repo /.git" ]]; then
echo "not_git"
return
fi
cd "$repo " || return
if ! git diff --quiet 2>/dev/null || ! git diff --cached --quiet 2>/dev/null; then
echo "uncommitted"
return
fi
local branch
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
local ahead
ahead=$(git rev-list --count "origin/$branch ..HEAD" 2>/dev/null || echo "0" )
if [[ "$ahead " -gt 0 ]]; then
echo "unpushed"
return
fi
git fetch origin "$branch " --quiet 2>/dev/null
local behind
behind=$(git rev-list --count "HEAD..origin/$branch " 2>/dev/null || )
[[ -gt 0 ]];
}
() {
repos=( )
repo ;
status
status=$(check_repo_status )
branch=
[[ -d ]];
branch=$( && git rev-parse --abbrev-ref HEAD 2>/dev/null)
color=
clean) color= ;;
uncommitted) color= ;;
unpushed) color= ;;
behind) color= ;;
*) color= ;;
}
4. Category-Based Operations
Filter repositories by category (Work/Personal):
#!/bin/bash
declare -A REPO_CATEGORIES
parse_categories () {
local gitignore="$1 "
while IFS= read -r line; do
if [[ "$line " =~ ^([a-zA-Z0-9_-]+)/[[:space:]]*#[[:space:]]*(Personal|Work|Both)$ ]]; then
local name="${BASH_REMATCH[1]} "
local category="${BASH_REMATCH[2]} "
REPO_CATEGORIES["$name " ]="$category "
fi
done < "$gitignore "
}
get_repos_by_category () {
local target_category="$1 "
local repos=()
for repo in "${!REPO_CATEGORIES[@]} " ; do
local category="${REPO_CATEGORIES[$repo]} "
if [[ "$category " == ]] || \
[[ == ]] || \
[[ =~ ]];
repos+=( )
|
}
parse_categories
get_repos_by_category
get_repos_by_category
5. Safe Branch Operations
Switch branches safely across repositories:
#!/bin/bash
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
if ! git diff --quiet 2>/dev/null || ! git diff --cached --quiet 2>/dev/null; then
echo "blocked: uncommitted changes"
return 1
fi
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
if git show-ref --verify --quiet "refs/remotes/origin/$target_branch " 2>/dev/null; then
git checkout -b " " 2>/dev/null
0
1
}
() {
target_branch=
repos=( )
repo ;
-n
switch_branch
}
Complete Example: Repository Sync CLI
Full implementation combining all patterns:
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]} " ) " && pwd) "
WORKSPACE_ROOT="${WORKSPACE_ROOT:-$(dirname "$SCRIPT_DIR")} "
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
declare -a REPOS=()
declare -A CATEGORIES=()
discover_repos () {
REPOS=()
while IFS= read -r line; do
[[ "$line " =~ ^[[:space:]]*# ]] && continue
[[ -z "$line " ]] && continue
local repo_name="${line%%/*} "
[[ -z "$repo_name " ]] && continue
if [[ -d "$WORKSPACE_ROOT /$repo_name /.git" ]]; then
REPOS+=("$repo_name " )
[[ =~
CATEGORIES[ ]=
< <(grep 2>/dev/null | -100)
}
() {
repos=( )
success=0 failed=0
repo ;
-n
( && git pull --quiet 2>/dev/null);
-e
((success++))
-e
((failed++))
}
() {
message=
repos=( )
committed=0 skipped=0
repo ;
( && ! git diff --quiet) || \
( && ! git diff --cached --quiet);
-n
( && git add -A && git commit -m --no-verify &>/dev/null);
-e
((committed++))
-e
((skipped++))
}
() {
repos=( )
success=0 failed=0
repo ;
-n
branch
branch=$( && git rev-parse --abbrev-ref HEAD)
( && git push origin --quiet 2>/dev/null);
-e
((success++))
-e
((failed++))
}
() {
message=
repos=( )
-e
do_pull
do_commit
do_push
}
() {
repos=( )
repo ;
category=
branch status
branch=$( && git rev-parse --abbrev-ref HEAD 2>/dev/null || )
! ( && git diff --quiet 2>/dev/null);
status=
[[ $( && git rev-list --count 2>/dev/null || 0) -gt 0 ]];
status=
status=
}
() {
<<
}
() {
=
scope=
message=
2 2>/dev/null ||
[[ -gt 0 ]];
-m|--message) message= ; 2 ;;
*) ;;
discover_repos
filtered_repos=()
repo ;
=
all) filtered_repos+=( ) ;;
work) [[ == || == ]] && filtered_repos+=( ) ;;
personal) [[ == || == ]] && filtered_repos+=( ) ;;
list) ;;
pull) do_pull ;;
commit) do_commit ;;
push) do_push ;;
) do_sync ;;
status) do_status ;;
|*) show_usage ;;
}
main
Best Practices
1. Always Check Before Operating
if ! git diff --quiet; then
echo "Error: uncommitted changes"
exit 1
fi
2. Use --no-verify for Batch Commits
git commit -m "message" --no-verify
3. Handle Offline/Network Errors Gracefully
if ! git pull --quiet 2>/dev/null; then
echo "Warning: could not pull (offline?)"
fi
4. Track Operation Statistics
SUCCESS=0; FAILED=0; SKIPPED=0
5. Validate Git Repositories
[[ -d "$repo /.git" ]] || continue
Resources
Version History
1.0.0 (2026-01-14): Initial release - extracted from workspace-hub repository sync scripts
"Already up.to"
then
echo
"${GREEN} ✓ (up to date)${NC} "
elif
cd
"$repo "
"$branch "
then
echo
"${GREEN} ✓ (updated)${NC} "
else
echo
"${YELLOW} ⚠ (offline or error)${NC} "
fi
fi
done
phase_commit
local
"$@ "
local
"${COMMIT_MESSAGE:-chore: Batch synchronization} "
echo
"\n${CYAN} PHASE 2: Staging and committing changes${NC} "
echo
"${CYAN} ───────────────────────────────────────${NC} "
for
in
"${repos[@]} "
do
if
"$repo /.git"
then
local
false
if
cd
"$repo "
then
true
fi
if
cd
"$repo "
then
true
fi
if
"$has_changes "
"true"
then
echo
"→ Committing $repo ... "
if
cd
"$repo "
"$message "
then
echo
"${GREEN} ✓${NC} "
else
echo
"${YELLOW} ⊘ (commit failed)${NC} "
fi
else
echo
"${YELLOW} ⊘ $repo : no changes${NC} "
fi
fi
done
phase_push
local
"$@ "
echo
"\n${CYAN} PHASE 3: Pushing to remote${NC} "
echo
"${CYAN} ──────────────────────────${NC} "
for
in
"${repos[@]} "
do
if
"$repo /.git"
then
local
cd
"$repo "
echo
"→ Pushing $repo ($branch )... "
if
cd
"$repo "
"$branch "
"Everything up-to-date|up to date"
then
echo
"${GREEN} ✓ (up to date)${NC} "
elif
cd
"$repo "
"$branch "
then
echo
"${GREEN} ✓ (pushed)${NC} "
else
echo
"${RED} ✗${NC} "
fi
fi
done
full_sync
local
"$@ "
"${repos[@]} "
"${repos[@]} "
"${repos[@]} "
echo
""
echo
"${CYAN} ═══════════════════════════════════════${NC} "
echo
"${CYAN} Summary${NC} "
echo
"${CYAN} ═══════════════════════════════════════${NC} "
echo
"Total Repos: ${#repos[@]} "
echo
"Successful: ${GREEN} ${SUCCESS} ${NC} "
echo
"Skipped: ${YELLOW} ${SKIPPED} ${NC} "
echo
"Failed: ${RED} ${FAILED} ${NC} "
echo
"0"
if
"$behind "
then
echo
"behind"
return
fi
echo
"clean"
batch_status
local
"$@ "
printf
"%-30s %-15s %s\n"
"Repository"
"Status"
"Branch"
printf
"%s\n"
"────────────────────────────────────────────────────────"
for
in
"${repos[@]} "
do
local
"$repo "
local
"N/A"
if
"$repo /.git"
then
cd
"$repo "
fi
local
""
case
"$status "
in
"${GREEN} "
"${YELLOW} "
"${CYAN} "
"${RED} "
"${NC} "
esac
printf
"%-30s ${color} %-15s${NC} %s\n"
"$repo "
"$status "
"$branch "
done
"$target_category "
"$target_category "
"all"
"$category "
$target_category
then
"$repo "
fi
done
printf
'%s\n'
"${repos[@]} "
sort
".gitignore"
echo
"Work repositories:"
"Work"
echo
"Personal repositories:"
"Personal"
$target_branch
"origin/$target_branch "
echo
"switched: created from remote"
return
fi
echo
"skip: branch not found"
return
batch_switch_branch
local
"$1 "
shift
local
"$@ "
echo
"Switching to branch: $target_branch "
echo
""
for
in
"${repos[@]} "
do
echo
"→ $repo : "
"$repo "
"$target_branch "
done
if
"$line "
"$repo_name "
"${BASH_REMATCH[1]} "
fi
fi
done
"/"
"$WORKSPACE_ROOT /.gitignore"
head
do_pull
local
"$@ "
local
for
in
"${repos[@]} "
do
echo
"Pulling $repo ... "
if
cd
"$WORKSPACE_ROOT /$repo "
then
echo
"${GREEN} ✓${NC} "
else
echo
"${YELLOW} ⚠${NC} "
fi
done
echo
"Pull complete: $success succeeded, $failed failed"
do_commit
local
"$1 "
shift
local
"$@ "
local
for
in
"${repos[@]} "
do
if
cd
"$WORKSPACE_ROOT /$repo "
cd
"$WORKSPACE_ROOT /$repo "
then
echo
"Committing $repo ... "
if
cd
"$WORKSPACE_ROOT /$repo "
"$message "
then
echo
"${GREEN} ✓${NC} "
else
echo
"${RED} ✗${NC} "
fi
else
fi
done
echo
"Commit complete: $committed committed, $skipped skipped (no changes)"
do_push
local
"$@ "
local
for
in
"${repos[@]} "
do
echo
"Pushing $repo ... "
local
cd
"$WORKSPACE_ROOT /$repo "
if
cd
"$WORKSPACE_ROOT /$repo "
"$branch "
then
echo
"${GREEN} ✓${NC} "
else
echo
"${RED} ✗${NC} "
fi
done
echo
"Push complete: $success succeeded, $failed failed"
do_sync
local
"${1:-chore: Batch sync} "
shift
local
"$@ "
echo
"${CYAN} === Full Sync ===${NC} "
"${repos[@]} "
echo
""
"$message "
"${repos[@]} "
echo
""
"${repos[@]} "
do_status
local
"$@ "
printf
"%-25s %-12s %-15s %s\n"
"Repository"
"Category"
"Status"
"Branch"
printf
"%s\n"
"────────────────────────────────────────────────────────────────"
for
in
"${repos[@]} "
do
local
"${CATEGORIES[$repo]:-Unknown} "
local
cd
"$WORKSPACE_ROOT /$repo "
echo
"N/A"
if
cd
"$WORKSPACE_ROOT /$repo "
then
"uncommitted"
elif
cd
"$WORKSPACE_ROOT /$repo "
"origin/$branch ..HEAD"
echo
then
"unpushed"
else
"clean"
fi
printf
"%-25s %-12s %-15s %s\n"
"$repo "
"$category "
"$status "
"$branch "
done
show_usage
cat
EOF
Usage: $(basename "$0") <command> [scope] [options]
Commands:
list [scope] List repositories
pull [scope] Pull all repositories
commit [scope] -m "msg" Commit changes
push [scope] Push to remote
sync [scope] -m "msg" Full sync (pull + commit + push)
status [scope] Show repository status
Scope:
all All repositories (default)
work Work repositories only
personal Personal repositories only
Examples:
$(basename "$0") pull all
$(basename "$0") sync work -m "End of day sync"
$(basename "$0") status personal
EOF
main
local
command
"${1:-help} "
local
"${2:-all} "
local
"chore: Batch operation"
shift
true
while
$#
do
case
"$1 "
in
"$2 "
shift
shift
esac
done
local
for
in
"${REPOS[@]} "
do
local
cat
"${CATEGORIES[$repo]:-Unknown} "
case
"$scope "
in
"$repo "
"$cat "
"Work"
"$cat "
"Both"
"$repo "
"$cat "
"Personal"
"$cat "
"Both"
"$repo "
esac
done
case
"$command "
in
printf
'%s\n'
"${filtered_repos[@]} "
"${filtered_repos[@]} "
"$message "
"${filtered_repos[@]} "
"${filtered_repos[@]} "
sync
"$message "
"${filtered_repos[@]} "
"${filtered_repos[@]} "
help
esac
"$@ "