Skip to main content

Commit and Push

Turning staged changes into a commit and getting it upstream: the commit composer, committing, pushing, setting an upstream on a new branch, and what each success and failure state means.

Updated
Reviewed

Committing

The composer sits at the bottom of working-tree mode, under the label Commit message. It is a monospace textarea that grows from two to six lines as you type, with the placeholder "Summary on the first line, details below". A vertical ruler marks column 72, and a counter beside the label tracks your subject line (48/72), adding a warning mark once the subject runs past 72 characters, a nudge toward the standard Git convention.

With a remote configured you get two buttons: a ghost Commit and a primary Commit & push. With no remote you get a single Commit.

A status line between the composer and the buttons says what the primary button will act on: 3 files staged · pushes to origin/feature/reconciliation, or no push destination set when git can't name one. While a commit or push runs, the same line reports it.

Recalling recent messages

With the cursor at the very start of the composer, ↑ walks back through the last eight commit messages on the worktree's branch, bodies included, and ↓ walks forward again, restoring your in-progress draft at the end. Once you edit the text, the recall index resets.

What blocks a commit

A commit needs at least one staged file and a message, and is blocked while conflicts are unresolved or the worktree is in detached HEAD. The buttons dim when any of those is missing, and the status line lists every unmet requirement in one sentence, most structural first, so fixing the named one never uncovers a second you weren't told about: Stage files and write a commit message to commit. Detached HEAD and conflicts add a warning mark.

The dimmed buttons still take a click. Clicking one, or pressing Command-Enter Control-Enter Control-Enter , moves focus to the first blocker: the conflict list, the stage-all button (expanding the file list if it was collapsed), or the composer.

When Review Hub opens with a cached file list, commit and push wait for the live status read before they act, and the status line reads Checking staged changes… until it lands. Typing stays open meanwhile.

When Review Hub is opened from a worktree card carrying an agent note, the composer can be pre-seeded with the note's first line, and only that. Nothing else is ever substituted as a commit message.

Tip
Command-Enter Control-Enter Control-Enter runs the primary action (Commit & push, or Commit with no remote). Shift-Command-Enter Control-Shift-Enter Control-Shift-Enter commits only.

Pushing

Where the push actually goes

Every git write that touches a remote (the push, the rescue push that sets an upstream, pull-and-rebase, force-with-lease, and the discard preview behind it) resolves the branch's real destination from git's own configuration instead of assuming origin. Daintree asks git the same question git asks itself, honoring branch.NAME.pushRemote, then remote.pushDefault, then branch.NAME.remote.

When it cannot get an answer, it fails closed. The confirm button is disabled with "No push destination is configured for this branch. Set an upstream, or configure a push remote, before pushing." Two or more remotes with nothing saying which one this branch pushes to is an explicit ambiguity, and it stays an ambiguity even when one of them is named origin. Sending a write to a repository you did not choose is not recoverable; a blocked button is a visible prompt to configure a remote.

Note
Why this matters for forks. In a triangular workflow your branch tracks upstream/main but pushes to fork/topic. Naming origin would push to the wrong repository, or refuse a push that git would have accepted. Because the destination is resolved rather than assumed, the confirm dialog names the real target on its destination pill and its primary button ("Push to fork/topic"), and the force-push dialog names it in its body. The push refspec is written explicitly as local-to-remote too, since the remote-side branch need not share the local name.

Pull-and-rebase deliberately resolves a different ref: your branch's upstream, not its push target. These are the same thing in the ordinary case and genuinely different in a fork workflow, and a rebase that used the push destination would replay your commits on top of a repository you never asked to integrate from.

The same discipline shows up around the change: behind-counts compare against the base branch's own tracking ref rather than assuming origin, and a PR head is fetched from the remote the PR was opened against: with the forge configured as upstream, fetching pull/N/head from origin simply fails with "couldn't find remote ref". Those two resolvers fail soft, falling back to previous behavior, because they feed a displayed number rather than a write.

The confirmation

Clicking Commit & push opens a confirmation titled "Push commits?" carrying a destination pill, a full preview of the commit message, and a Don't ask again for this worktree checkbox. Tick it and future pushes from that worktree skip the dialog. On a protected branch the description adds a line noting that most teams use pull requests instead. The destination is named on the pill and again on the primary button: Push to origin/main, or whatever git resolved.

The title is deliberately fixed rather than interpolated. A heading that reads "Push to ''?" until the destination lands, then quietly swaps from naming your local branch to naming a remote ref, changes what the dialog is asking mid-flight. The refs sit in the body, which is a place that can hold a pending or unresolved state honestly.

The opt-out is not a blanket one. It is stored per worktree path and consulted only by Review Hub's own Commit & push. Even inside Review Hub it is overridden when the destination will not resolve: an unresolvable push always shows the dialog, because the dialog is where that failure is explained.

Review the message and destination before pushing to a protected branch

During the push, the status line reads Pushing to origin/main and a row per git stage (Enumerating objects, Counting objects, Compressing objects, Writing objects and so on) shows its progress bar and percentage. If git reports nothing new for 15 seconds, the line adds no new progress in the last 15s rather than leaving you to guess whether it stalled. The composer stays put through the push it started. A branch with no tracking configuration yet (the normal state of a freshly created worktree branch) gets its upstream set for you on the first push, to the destination that was already resolved and confirmed. No need to run git push --set-upstream by hand.

The publish preview

The global Command-K, then Command-P Control-K, then Control-P Control-K, then Control-P chord, Git > Push on a worktree card, and the Push button Review Hub shows on a clean tree with unpushed commits all open a different dialog, and silencing Review Hub's does not silence it. That is deliberate: a push you fire without a file list in front of you is the one that most deserves a preview. It has no Don't ask again checkbox for the same reason.

It is titled "Push commits?" and its primary button is Push commits. What it previews is the publish range, not the branch's recent history. A From row names your local branch and a To row names the resolved destination; under them, Commits to push lists what actually sits between the destination's tip and your branch: short hash, subject and author, with a total. The list scrolls, and a range longer than Daintree fetched ends with a line such as Listing the 100 most recent of 140. The two are the same set only on a branch that has never been pushed; on every other branch a recent-history list would be showing you commits the push will not write.

Two labels beside the destination qualify it when the range could not be settled the ordinary way:

  • creates this branch: the remote confirmed the destination branch does not exist, so the push creates it and the rows are the branch's own history.
  • not verified: the destination couldn't be checked, so the rows are worked out from your repository alone and can both overstate and understate. A Couldn't verify the outgoing commits warning above the list says so, with a Retry.
Warning

A broken read never renders as an all-clear. If git fails, the preview does not fall back to an empty list; it reports Couldn't read what this would publish with git's own message and a Retry, and the button stays disabled with "Retry the preview to continue" beside it.

That is a different state from a genuine Nothing to publish, which says that as of the last fetch the destination already has everything on this branch. That is a settled answer and is approvable: confirming it simply pushes nothing.

And a third state sits between them. An empty unverified range reads "Nothing found to publish, but that isn't confirmed." Nothing was found locally, which is not the same claim as the destination being up to date.

When the destination has commits your branch doesn't, a warning says how many, as of the last fetch. It doesn't block the push: git will refuse it rather than overwrite them, and that refusal is what makes a force-with-lease recovery possible.

The states that do block the button name themselves, with the fix on a line beside the buttons: a repository operation in progress ("Finish the rebase to continue"), a detached HEAD (No branch checked out), a repository with no remote (No remote to publish to, with git remote add <name> <url>), and a destination git cannot name (No destination for this branch, with git push -u <remote> <branch> spelled out, since setting an upstream resolves both the missing and the ambiguous case). Git writes are not exposed over Daintree's MCP server; an agent that pushes does so with git in its own terminal, outside these dialogs.

Review the actual outgoing commits before publishing

When a push fails

A red Push failed banner explains why and what to do about it, and an X dismisses it. Authentication, rate-limit, network, and filesystem failures keep the detail short and offer Retry where retrying can help. Policy, hook, and similar refusals tuck the raw output behind a Server output or Git output disclosure, because the server's own text is often the only actionable signal. An auth failure may also show a forge error code and an Open forge settings button routed to that provider's settings. A push rejected because the remote moved on offers Pull and rebase, and Force push… when it is safe to; see Recovering from divergence.

Calls to action are limited to things the app can actually do. A clear hint with no button beats a button that does not work.