docs/private-mirror-sync-workflow.md
Use this when you work in a public fork clone locally but want to keep your full WIP history in a private mirror repo.
Example mapping used here:
~/repos/pqrs-org/Karabiner-Elements-user-command-receiverorigin = nikivdev/Karabiner-Elements-user-command-receiverupstream = pqrs-org/Karabiner-Elements-user-command-receiverprivate = nikivdev/Karabiner-Elements-user-command-receiver-imain locally.origin/main.main to a private fork/mirror.main# from repo root
git stash push -u -m "move-to-main"
git switch main
git merge --ff-only <feature-branch>
If --ff-only fails, do a normal merge or cherry-pick intentionally.
origin/mainIf you want strict origin-only sync (no upstream automation):
git fetch origin --prune
git rebase origin/main
Then reapply stash:
git stash apply stash@{0}
Avoid runtime artifacts (out/logs/*, todo scratch files, etc.).
git add -A -- ':!out/logs/cli.log' ':!out/logs/trace.log' ':!.ai/todos/todos.json'
git commit -m "<message>"
# one-time creation
gh repo create nikivdev/<repo>-i --private --source=. --remote=private --disable-wiki
# publish branch
git push -u private main
f sync)f sync can use jj integration and may rebase against upstream depending on repo setup.
That is useful in normal fork workflows, but if you need strict origin-only syncing for a private mirror flow, prefer explicit Git commands:
git fetch origin --prune
git rebase origin/main
Then use Flow for commit/review as usual.
f sync creates jj conflict artifactsSymptoms:
jj conflict commits.jjconflict-base-* / .jjconflict-side-*Recovery pattern:
git stash push -u)origin/mainmaingit stash push -u -m "recovery"
git fetch origin --prune
git switch -c main-clean origin/main
git cherry-pick <commit1> <commit2>
git stash apply <stash-with-real-work>
git branch -f main main-clean
git switch main
main tracking private mirrorIf this repo is now private-first for your local work:
git push -u private main
and keep origin/upstream as fetch sources for rebases.