agentleFS
dmzoneilldmzoneill/skills/sync-branch/SKILL.md

sync-branch

Skill2 starsChanged 21 days agoApache-2.0View on GitHub

Quickly sync current branch with main using rebase. Use when you need to pull latest main into your feature branch, before creating MR or after ongoing work. Fetches main, rebases, auto-stashes changes, optionally force-pushes.

  • Deletes or force-pushes
  • Commits and pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use repo, repo_name, issue_key, or cwd from config

    line 28
  2. Very specific:

    If uncommitted changes and stash_changes: git_stash(repo, action="push", message="sync_branch: auto-stash before rebase")

    line 34
  3. Distinctive:

    If conflicts: list files, resolution steps

    line 76
  4. Very specific:

    If not pushed: git push --force-with-lease origin {branch}

    line 77

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Sync Branch

Rebase current feature branch onto main. Less aggressive than rebase_pr — good for ongoing work.

Inputs

InputTypeDefaultPurpose
repostringcwdRepository path
repo_namestring-Config repo name (e.g. automation-analytics-backend)
issue_keystring-Jira key to resolve repo
base_branchstringmainBranch to sync with
stash_changesbooltrueStash uncommitted changes before rebase
force_pushboolfalseForce push after successful rebase
run_lintingbooltrueRun black/flake8 before force push

Workflow

1. Load Persona

  • persona_load("developer")

2. Resolve Repository

  • Use repo, repo_name, issue_key, or cwd from config
  • Get default_branch from config (usually main)

3. Pre-flight

  • git_status(repo) — get current branch, check uncommitted changes
  • Abort if on main/master
  • If uncommitted changes and stash_changes: git_stash(repo, action="push", message="sync_branch: auto-stash before rebase")

4. Fetch

  • git_fetch(repo, prune=true)

5. Check Commit Status

  • git_log(repo, range_spec="HEAD..origin/{base_branch}", count_only=true) — commits behind
  • git_log(repo, range_spec="origin/{base_branch}..HEAD", count_only=true) — commits ahead

6. Rebase (if behind > 0)

  • git_rebase(repo, onto="origin/{base_branch}")
  • On conflict: report conflict files, suggest git add + git rebase --continue

7. Pop Stash (if stashed and rebase success)

  • git_stash(repo, action="pop")

8. Linting (if force_push and run_linting)

  • git_format / git_lint — black, flake8
  • Block push if lint fails

9. Force Push (if force_push and rebase success)

  • git_push(repo, branch="{current_branch}", force=true)

10. Memory

  • memory_session_log("Synced branch {branch}", "behind: X, rebased: success")
  • On conflict: learn_tool_fix("git_rebase", "conflict", "Merge conflicts", "Resolve manually, git add, git rebase --continue")

MCP Tools

  • persona_load
  • git_status
  • git_stash (push/pop)
  • git_fetch
  • git_log
  • git_rebase
  • git_push
  • memory_session_log
  • learn_tool_fix

Output Summary

  • Already up to date / Successfully rebased / Conflicts detected
  • If conflicts: list files, resolution steps
  • If not pushed: git push --force-with-lease origin {branch}

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.