Skip to content

feat: --publish pushes stack branches that have no upstream yet - #23

Merged
pablospe merged 2 commits into
mainfrom
feat/publish
Nov 20, 2026
Merged

pablospe merged 2 commits into
mainfrom
feat/publish

Conversation

@pablospe

Copy link
Copy Markdown
Owner

wt sync -p only pushes branches that already have an upstream, and until now it skipped the rest silently. With a stack like osc1717 -> {editor-line -> copy-line, hunk-nav, watch-pos} where only osc1717 had been pushed, the output listed one push and nothing else, so it was easy to think the whole stack went up.

Now -p (and -n, --push-only) says which branches it left local, e.g. "Not pushing editor-line, copy-line: they have no upstream yet. Publish them with wt sync --publish."

--publish is the opt-in to push them. It implies --push (or combines with --push-only) and pushes each new branch with git push -u, no force, to the remote its nearest pushed parent uses. If nothing under it is pushed, it falls back to remote.pushDefault, then origin, then the only remote. The root branch is deliberately not consulted: in a fork main usually tracks the original repo, and new branches shouldn't land there.

While running the suite I also hit a flaky test: in branch_with_merge_commits_is_not_flattened, integration was equally close to a and b, and the tie could go either way. a now has two commits so it's the clear parent.

-p used to skip branches with no upstream without a word, so a half-pushed stack looked pushed. It now names them, and --publish pushes them with git push -u to the remote their nearest pushed parent uses (else remote.pushDefault, origin, or the only remote; never the root's remote, which in a fork is the original repo).

Also makes the merge-commit test deterministic: integration was equidistant from a and b.
@pablospe
pablospe merged commit 229fd6a into main Nov 20, 2026
2 checks passed
@pablospe
pablospe deleted the feat/publish branch November 20, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant