Skip to content

fix(publish): push the current branch when git.branch is unset - #696

Merged
goosewobbler merged 2 commits into
mainfrom
fix/688-push-current-branch
Oct 22, 2026
Merged

goosewobbler merged 2 commits into
mainfrom
fix/688-push-current-branch

Conversation

@goosewobbler

@goosewobbler goosewobbler commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Description

GitConfigSchema.branch defaulted to 'main', and mergeGitConfig fell back to 'main' when only publish.git was set. So any config with a git or publish.git block made publish run git push <remote> main, and a direct release from another branch left the release commit local while pushing its tags.

Both defaults are gone: an unset branch reaches publish as undefined, and the existing current-branch fallback runs. The standing PR's base still defaults to main (git?.branch ?? 'main'). Nothing else reads git.branch: preview, draft, backfill, version, notes and the Action all checked. The schema description now states both fallbacks; schema and config docs regenerated.

A direct release from a detached HEAD with a git block but no git.branch now stops with the existing "detached HEAD — set git.branch or pass --branch" error, instead of pushing a local main that doesn't hold the release commit.

Related Issue(s)

Closes #688

Type of Change

  • feat — New feature
  • fix — Bug fix
  • docs — Documentation change
  • refactor — Code refactoring
  • test — Adding or updating tests
  • chore — Maintenance, dependencies, tooling
  • Breaking change — Requires major version bump

Scope

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release
  • @releasekit/config
  • @releasekit/core
  • CI / workflows
  • Root / monorepo

Checklist

  • Lint passes (pnpm lint)
  • Tests pass (pnpm test)
  • Typecheck passes (pnpm typecheck)
  • Documentation updated (if applicable)
  • Breaking changes noted in description

Testing Notes

  • git-push.spec.ts loads real configs (git, git + publish, publish.git) with no branch, on feature/my-branch, and asserts that branch is pushed. The last two pushed main before the fix; the git-only row starts mattering once fix(publish)!: apply schema publish defaults when the config has no publish block #690 merges the top-level git config without a publish block.
  • mergeGitConfig leaves branch undefined when neither level sets it.
  • The standing PR targets main when git.branch is unset.
  • After rebasing on main: config, publish and release suites pass (turbo run test --force); schema:check and docs:check clean.

#684 also edits git-push.spec.ts, so whichever merges second may need a small rebase.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Removes the implicit main default so publishing uses the current branch when git.branch is unset.

  • Publishing uses the checked-out branch when git.branch is unset.

No actionable issues found. Tests were inspected, not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[git.branch unset] --> B[Schema and merge leave it unset]
  B --> C[Direct publish]
  B --> D[Standing release PR update]
  C --> E[Push current branch]
  C --> F[Detached HEAD: stop with error]
  D --> G[Use main as PR base]
Loading

Reviews (1) · Last reviewed commit: "fix(publish): push the current branch wh..." · Reviewed by Greptile

GitConfigSchema.branch defaulted to 'main', and mergeGitConfig fell back to
'main' when only publish.git was set, so any config with a git or publish.git
block handed publish branch 'main'. A direct release from another branch then
ran `git push <remote> main`, leaving the release commit local while the tags
were pushed.

Drop both defaults so an unset branch reaches publish as undefined and the
current-branch fallback runs. The standing PR's base still defaults to main.

Closes #688

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Standing release PR: #614 · v0.42.0 queued (4 packages) · open 82d 4h 21m · ✅ ready to merge

Release Preview — v0.41.2 → v0.41.3

Note: Labels on this PR are advisory in standing-pr mode. Bumps come from conventional commits in the standing PR; override by editing labels on the standing PR itself. Add release:immediate to bypass the standing PR and release this PR directly.

These changes will be added to the release PR (#614) when merged:

Changelog

monorepo 0.41.2 → 0.41.3

Changed

  • clarify the git.branch description (config)

Fixed

  • keep per-package and baseline tags in --input (publish) (PR #684 · closes #675)
  • push the current branch when git.branch is unset (publish) (#688)

All packages → 0.41.3 (sync versioning)

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release

After merge — predicted release

No version escalation — this PR's changes will be included in the queued release without affecting the projected versions.

Package Standing PR This PR After merge
monorepo 0.42.0 0.41.3 0.42.0

Updated automatically by ReleaseKit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Publish pushes main instead of the current branch whenever a git block is configured

1 participant