Force Push Confirm

Force Push Confirm is a copy-paste React component that stops teammates' commits erased by force push before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/force-push-confirm
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsTeammates' commits erased by force push

Was this component page useful?

How do I install Force Push Confirm?

pnpm dlx shadcn@latest add @bollard/force-push-confirm

The files land in your project. They're yours to edit.

How do I use Force Push Confirm in React?

force-push-confirm-usage.tsx
import { ForcePushConfirm, type RemoteCommit } from "@/components/ui/force-push-confirm"

<ForcePushConfirm
  branch="feature/checkout"
  remoteSha={tip}
  lost={commits(base)}
  me={{ emails: ["tushar@users.noreply.github.com"] }}
  protectedBranches={["main", "release/*"]}
  otherBranches={["main", "develop"]}
  onCancel={() => setDone("Cancelled. Nothing was pushed.")}
  onConfirm={({ command }) => new Promise<void>((resolve) => setTimeout(() => (setDone(`Ran: ${command}`), resolve()), 700))}
/>

What input mistakes does Force Push Confirm catch?

  • Commits on the remote that the push would drop
  • Commits by other people, including co-authors and GitHub noreply addresses
  • Protected branches
  • A remote tip that moved since you looked
  • Plain --force, replaced by a pinned --force-with-lease

What props does Force Push Confirm accept?

ForcePushConfirm props
PropTypeDefault
otherBranches

Other branch names; typing one of them is called out instead of silently not matching.

string[][]
defaultLease

Start with the lease on.

booleantrue
onConfirm

Called with the command to run. May return a Promise; the button shows a pending state and ignores repeat clicks.

(push: { command: string; lease: boolean }) => void | Promise<void>—
onCancel

Shows a Cancel button.

() => void—
maxCommits

How many lost commits to list before a "Show more" button; other people's commits are always listed first.

number8
locale

Locale for "3 hours ago" and the people list.

string—
messages

Any visible string.

Partial<ForcePushMessages>—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Force Push Confirm accessible?

  • Dropped commits are a labelled list
  • The lease option is a labelled checkbox; branch confirmation is a typed field
  • Warnings use icons plus text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Protect shared branches in your Git host (no force pushes, required reviews); this dialog only prepares a safer command.

  • Uses the commit lists you pass; it doesn't run git
  • --force-with-lease only protects the tip you pinned; your Git host's branch protection is the real guard

What expensive mistakes does Force Push Confirm stop?

Teammates' commits erased by force push

Also known as

git push --force · force-with-lease · force-if-includes · rebase · protected branch · github · remote branch

Field type

What dependencies does Force Push Confirm require?

Force Push Confirm facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameForce Push Confirm
Registry identifier@bollard/force-push-confirm
Install commandnpx shadcn@latest add @bollard/force-push-confirm
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Force Push Confirm

How does Force Push Confirm protect destructive mutations?

Force Push Confirm prevents teammates' commits erased by force push. Enforces deliberate friction against Commits on the remote that the push would drop, Commits by other people, including co-authors and GitHub noreply addresses, Protected branches, A remote tip that moved since you looked, Plain --force, replaced by a pinned --force-with-lease. Limitation: authorize force-push-confirm mutations on the server.

How do I install force-push-confirm with shadcn?

Run `npx shadcn@latest add @bollard/force-push-confirm`. Sources added: registry/default/force-push-confirm/force-push-confirm.tsx, registry/default/force-push-confirm/force-push.ts. Package requirements: lucide-react.

What props customize Force Push Confirm?

Force Push Confirm accepts `otherBranches`, `defaultLease`, `onConfirm`, `onCancel`, `maxCommits`. Configures git push --force, force-with-lease, force-if-includes behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of force-push-confirm?

Uses the commit lists you pass; it doesn't run git. --force-with-lease only protects the tip you pinned; your Git host's branch protection is the real guard Server requirement: Protect shared branches in your Git host (no force pushes, required reviews); this dialog only prepares a safer command.

How does Force Push Confirm meet accessibility guidelines?

Dropped commits are a labelled list. The lease option is a labelled checkbox; branch confirmation is a typed field. Warnings use icons plus text. Minimizes errors: force push deleted commits, git push -f overwrote remote.

Which components pair with Force Push Confirm?