concurrent-push-integration
Skill34 starsChanged 37 days agoMITView on GitHub
When a push to a shared branch is REJECTED (the remote advanced), integrate the incoming work — never force over it. Invoke when `git push` fails with non-fast-forward / "fetch first", whenever two or more writers (agents, or an agent and a human, or an automated export) share write access to one repo, or any time you are about to reach for `--force`. A rejected push is information — someone else pushed — not an obstacle to bulldoze.
- Deletes or force-pushes
- Commits and pushes
In this repository31 other files it gives its agents.
- .github/AGENTS.mdAGENTS.md
- tui/AGENTS.mdAGENTS.md
- actionability-passSkill
- agent-memory-opsSkill
- blocked-page-retrievalSkill
- brain-consistency-auditorSkill
- brainstorm-panelSkill
- curation-auditSkill
- decomposed-local-researchSkill
- dual-model-reconciliationSkill
- eval-integritySkill
- file-organizationSkill
- fleet-model-routingSkill
- fleet-operational-runbookSkill
- generate-review-fix-loopSkill
- guard-target-correctnessSkill
- honesty-stop-gateSkill
- large-file-cartographerSkill
- local-lane-build-loopSkill
- local-model-onboardingSkill
- model-routing-tableSkill
- multi-agent-code-workflowSkill
- peer-drop-watcherSkill
- protected-function-guardSkill
- research-dispatchSkill
- research-verificationSkill
- research-workflowSkill
- shared-brain-bookkeepingSkill
- should-weSkill
- task-dependency-sequencingSkill
- verify-running-buildSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
When more than one writer can push to the same branch, git push will sometimes be rejected with !
- Very specific: line 34
Use --force-with-lease, never bare --force.
≈ “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
Concurrent Push Integration — a rejected push means integrate, not overwrite
When more than one writer can push to the same branch, git push will sometimes be rejected with
! [rejected] ... (fetch first) (non-fast-forward). This is not an error to force past — it is the remote
telling you someone else advanced the ref while you were working. Reaching for git push --force is the
destructive move: it replaces the remote's history with yours and silently discards whatever the other writer
pushed.
The protocol
- Never
--forceto clear a rejection. A rejection means the remote has commits you don't have. Forcing deletes them — in a multi-writer setup, that is another party's work. - Fetch and read what landed.
git fetch origin, thengit log --oneline <your-base>..origin/mainandgit diff --stat <your-base>..origin/main. Now you can tell a benign parallel edit from a real conflict. - Check for overlap with your own pending change — same files, same lines? No overlap → a clean rebase. Overlap → the rebase pauses on the conflicting hunk for you to resolve, keeping both intents.
- Rebase (or merge) your work on top of the remote:
git rebase origin/main. You are moving your commit to sit after theirs, not replacing theirs. - Verify BOTH survived before pushing. Grep the working tree for your change AND theirs. A rebase that silently dropped one side is worse than the rejection — do not trust "rebase succeeded", read the result.
- Push — now a fast-forward.
The one time force is legitimate — and how to make it safe
A deliberate, authorized rewrite of a commit you just pushed (e.g. correcting a malformed author email on your own tip commit) is a real use of force. Even then:
- Use
--force-with-lease, never bare--force.--force-with-leaserefuses the push if the remote has moved since your last fetch — so if another writer slipped a commit in, the lease FAILS and stops you, which is precisely the signal to go integrate instead. Bare--forcehas no such guard and overwrites blind. - A lease failure is not an obstacle either — it is the same "someone else pushed" signal. Fetch, integrate, and re-decide whether the rewrite is still needed.
Why this matters more with agents than with people
Two humans on one repo coordinate socially ("I'm pushing now"). Two agents — or an agent and a human, or an agent and an automated export — push on independent schedules with no shared clock, so collisions are normal, not exceptional. The capability to push is shared, which makes "who pushes" a coordination decision, not a capability limit; the integration discipline above is what makes shared write access safe instead of a clobber lottery.
Why this exists
Distilled from a live incident where an agent and a human collaborator (the repository owner) both held push access to one repository. The agent's push was rejected mid-task because the human had pushed a one-line change moments earlier. The agent fetched, confirmed the incoming edit did not overlap its own, rebased on top, verified both changes survived in the tree, and pushed a fast-forward — no work lost on either side.
The agent-and-human case is the sharper one: a claim/driver lock can stop two agents from colliding, but it cannot bind a human collaborator's own hands — so recovery after a collision, not just prevention of one, is mandatory. (The incident was first written up with the wrong participant — "two agents" — which would have taught the wrong prevention; corrected here, which is itself the argument for recording provenance.) Generalized; identifiers removed.
Related: specs/driver-lock-protocol.md is the prevention half — claim a region before writing so two
agents don't collide. This skill is the recovery half — what to do once a collision has happened anyway,
which a lock cannot prevent when one writer sits outside its authority.
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.

