sync-git-branch-continuously
Skill692 starsChanged 6 days agoApache-2.0View on GitHub
Runs and manages an automated continuous synchronization loop (pull and push) for Git branches. Use when asked to continuously sync, pull, or push a Git branch in the background for Git repositories.
- Commits and pushes
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analyze-ci-failureSkill
- buildkite-get-resultsSkill
- conversation-doneSkill
- create-newsSkill
- create-prSkill
- merge-prSkill
- monitor-ci-resultsSkill
- process-dependabot-prsSkill
- retry-ci-jobSkill
- review-codeSkill
- rule-creatorSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 90
When git pull or git push fails due to invalid or expired credentials:
- Distinctive: line 92
Keep the background sync process running so it automatically resumes if credentials are refreshed incidentally.
- Very specific: line 97
After the user responds, trigger an immediate sync cycle (kill -USR1 <PID>) and verify the sync log.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sync Git Branch Continuously
Runs a continuous pull and push loop in the background for Git repositories to keep a local branch synchronized with remote branches. This helps ensure that new worktrees based off of main are more up to date.
Workflow Loop
The sync loop periodically executes:
git pull --ff-only <pull-from-remote> <pull-from-branch>git push <push-to-remote> HEAD:<push-to-branch>- Sleeps until timeout (e.g., 60s) or until awakened by an asynchronous
SIGUSR1signal.
Script Location
The synchronization script is located at:
scripts/sync_git_branch_continuously.py under this skill directory.
Running the Continuous Sync Script
To start the continuous sync script as a background daemon process:
# Sync active branch with tracking remote every 60s (default):
REPO_NAME=$(basename "$(git rev-parse --show-toplevel 2>/dev/null || pwd)")
BRANCH_NAME=$(git branch --show-current 2>/dev/null || echo "default")
./.agents/skills/sync-git-branch-continuously/scripts/\
sync_git_branch_continuously.py \
> "/tmp/sync_git_${REPO_NAME}_${BRANCH_NAME}.log" 2>&1 &Script Options
--pull-from-branch <name>: Remote branch to pull from (defaults to active branch).--push-to-branch <name>: Remote branch to push to (defaults to active branch).--pull-from-remote <name>: Remote repository to pull from (defaults to tracking remote ororigin).--push-to-remote <name>: Remote repository to push to (defaults to tracking remote ororigin).--interval <seconds>: Sleep interval between sync iterations (default:60seconds).
Example with custom source and target destinations:
./.agents/skills/sync-git-branch-continuously/scripts/\
sync_git_branch_continuously.py \
--pull-from-remote upstream --pull-from-branch main \
--push-to-remote origin --push-to-branch feature \
--interval 30 \
> "/tmp/sync_git_main.log" 2>&1 &Asynchronous Sync Triggers (Signals)
Other processes or agent conversations can asynchronously wake up the daemon and trigger an immediate pull/push cycle without waiting for the interval to expire:
# By PID:
kill -USR1 <PID>
# Or by matching process name:
pkill -USR1 -f "sync_git_branch_continuously.py"Monitoring & Logs
To check the status or inspect the output of the active background sync loop:
tail -n 20 "/tmp/sync_git_${REPO_NAME}_${BRANCH_NAME}.log"Authentication Failures
When git pull or git push fails due to invalid or expired credentials:
- Keep the background sync process running so it automatically resumes if credentials are refreshed incidentally. Never mask or sanitize authentication errors to suppress wakeups.
- Prompt the user via
ask_questionso a UI popup alerts them to re-authenticate. - After the user responds, trigger an immediate sync cycle (
kill -USR1 <PID>) and verify the sync log.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

