{"record":{"id":"b01be4ac544a5e8a","repo":"jdx/mise","slug":"global-configuration-at-shown-cannot-be-fast-for","errorCode":null,"errorMessage":"global configuration at {shown} cannot be fast-forwarded to the transferred revision","messagePattern":"global configuration at (.+?) cannot be fast-forwarded to the transferred revision","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":276,"sourceCode":"        }\n        if update {\n            if git(destination, &[\"symbolic-ref\", \"--short\", \"HEAD\"])? != branch {\n                bail!(\"global configuration branch differs from the transferred branch\");\n            }\n            if dry_run {\n                // the bundle holds the history from the checkout's commit on,\n                // so the fast-forward is checked there without fetching into\n                // the destination\n                let head = git(destination, &[\"rev-parse\", \"HEAD\"])?;\n                if head == revision {\n                    miseprintln!(\n                        \"Would keep {shown} at {revision}, already the transferred revision\"\n                    );\n                } else if git(&checkout, &[\"merge-base\", \"--is-ancestor\", &head, revision]).is_ok()\n                {\n                    miseprintln!(\"Would fast-forward {shown} from {head} to {revision}\");\n                } else {\n                    bail!(\n                        \"global configuration at {shown} cannot be fast-forwarded to the transferred revision\"\n                    );\n                }\n                return Ok(destination.to_path_buf());\n            }\n            git(\n                destination,\n                &[\n                    \"fetch\",\n                    \"--no-tags\",\n                    bundle\n                        .to_str()\n                        .ok_or_else(|| eyre::eyre!(\"invalid bundle path\"))?,\n                    \"HEAD\",\n                ],\n            )?;\n            git(\n                destination,","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote_repository.rs#L258-L294","documentation":"In a dry-run update of an existing global-configuration checkout, mise checks whether the destination's current HEAD is an ancestor of the transferred revision (a fast-forward). If HEAD has diverged — it contains commits not present in the transferred history — a `--ff-only` merge would fail, so mise reports the situation up front instead of attempting it.","triggerScenarios":"install/install_source/preview_source (install_at) with update and dry_run enabled where `git merge-base --is-ancestor <dest-HEAD> <revision>` fails, i.e. the destination has local commits that were rebased, amended, or never pushed to the transferred repository.","commonSituations":"Local commits made directly in the destination checkout that were never pushed; history was rewritten upstream (force-push/rebase) so old commits are no longer ancestors; onboarding a machine whose checkout is ahead of the shared repo.","solutions":["Push the destination's local commits to the source repository and re-transfer, so the revision includes them.","Rebase the destination onto the transferred revision manually, then retry (HEAD will then be an ancestor).","If the local commits are disposable, hard-reset the destination to the remote branch: `git -C <destination> reset --hard origin/<branch>`.","Inspect the divergence with `git -C <destination> log --oneline origin/<branch>..HEAD` before deciding."],"exampleFix":"// before: destination has diverged\n$ git -C ~/.config/mise log --oneline origin/main..HEAD\na1b2c3d local tweak\n\n// after: push the commit so the transferred revision contains it\n$ git -C ~/.config/mise push origin HEAD:main\n// then re-package the bundle and retry the install","handlingStrategy":"validation","validationCode":"const head = execSync(`git -C ${dest} rev-parse HEAD`).toString().trim();\nconst diverged = execSync(`git -C ${dest} log --oneline origin/${branch}..HEAD`).toString().trim();\nif (diverged) throw new Error('destination has local commits not in the transferred revision: ' + diverged);","typeGuard":null,"tryCatchPattern":"try {\n  await installSource(bundle, origin, { update: true, dryRun: true });\n} catch (e) {\n  if (/cannot be fast-forwarded/.test(String(e.cause ?? e))) {\n    console.error('push or rebase local commits in ' + dest + ' before updating');\n  }\n  throw e;\n}","preventionTips":["Treat the destination checkout as read-only: push changes via the source repo workflow, not by committing locally","Never force-push/rebase the shared config branch","Run the install in dry-run first to detect divergence before a real update"],"tags":["git","diverged-history","fast-forward","dry-run"],"backgroundTag":"invalid-state-transition","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}