
force-push-downstream
โ Officialโ 3,392by brave ยท part of brave/brave-core
Force-push a branch and all its downstream branches to origin. Auto-detects
This is the playbook your agent receives when the skill activates โ you don't need to read it to use the skill, but it's here to audit before installing.
Force Push Downstream
Force-push a branch and all its downstream branches to their respective remotes. Skips branches whose local and remote tips already match.
Arguments
starting-branch(optional) โ The branch to start from. Defaults to the current branch if not specified.
Examples:
/force-push-downstreamโ push current branch + all downstream/force-push-downstream candle-service-webuiโ push from that branch down
Current State
- Branch: !
git branch --show-current - Status: !
git status --short
Steps
1. Determine starting branch
If an argument was provided, use it as the starting branch. Otherwise use the current branch.
git branch --show-current2. Detect downstream chain
Run the detect-chain script (shared with rebase-downstream) to find all downstream branches:
bash .claude/skills/rebase-downstream/detect-chain.sh <starting-branch>3. Build push list
The push list is: the starting branch itself, followed by every downstream branch in tree order (from detect-chain output).
4. Show plan and confirm
Display the branches that will be pushed:
Force push plan:
candle-service-background-webcontents
โ background-webcontents-timer
โ candle-service-webui
โ candle-service-model-loading
โ brave-history-embeddings
โ local-ai-internalsFor each branch, check if it is already up-to-date with origin:
# Get local and remote SHAs
local_sha=$(git rev-parse <branch>)
remote_sha=$(git rev-parse origin/<branch> 2>/dev/null || echo "none")If local_sha == remote_sha, mark as (up-to-date, will skip). If the remote
branch doesn't exist, mark as (new, will push). Otherwise mark as
(diverged, will force-push).
Ask the user to confirm before pushing.
5. Push each branch
For each branch in the push list:
-
Skip if up-to-date: If local SHA matches origin SHA, print skip message and move on.
-
Force push:
git push --force-with-lease origin <branch>Use
--force-with-leasefor safety โ it fails if someone else pushed to the remote since our last fetch, preventing accidental overwrites of others' work. -
If the remote branch doesn't exist (first push), use:
git push -u origin <branch> -
Report result: Print success/failure for each branch.
6. Report summary
After all pushes complete, show a summary:
Force push results:
โ candle-service-background-webcontents (pushed)
- background-webcontents-timer (skipped, up-to-date)
โ candle-service-webui (pushed)
โ candle-service-model-loading (pushed)
โ brave-history-embeddings (pushed, new)
โ local-ai-internals (failed: ...)Important
- Always use
--force-with-leaseinstead of--forcefor safety - Do NOT push without user confirmation
- Skip branches that are already up-to-date (local == remote SHA)
- If any push fails, report it but continue with remaining branches
- Return to the original branch at the end
npx skills add brave/brave-core --skill "force-push-downstream" --full-depthRun this in your project โ your agent picks the skill up automatically.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
Licensed under MPL-2.0โ you can use, modify, and redistribute it under that license's terms.
View the full license file on GitHub โ