{"record":{"id":"89bdc6c5b708254b","repo":"jdx/mise","slug":"global-configuration-branch-differs-from-the-trans","errorCode":null,"errorMessage":"global configuration branch differs from the transferred branch","messagePattern":"global configuration branch differs from the transferred branch","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":261,"sourceCode":"    git(\n        &checkout,\n        &[\"-c\", \"core.hooksPath=/dev/null\", \"checkout\", &branch],\n    )?;\n    if destination.join(\".git\").exists() {\n        if git(destination, &[\"remote\", \"get-url\", \"origin\"])? != origin {\n            bail!(\"global configuration origin does not match\");\n        }\n        if !git(\n            destination,\n            &[\"status\", \"--porcelain\", \"--untracked-files=no\"],\n        )?\n        .is_empty()\n        {\n            bail!(\"global configuration has uncommitted changes\");\n        }\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                }","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/remote_repository.rs#L243-L279","documentation":"When `--update` is requested and the destination is already a Git checkout, install_at compares the destination's current branch (`git symbolic-ref --short HEAD`) with the branch of the transferred bundle. If they differ, the fast-forward-only update cannot proceed, because the tool never merges across branches. It aborts to avoid switching or merging the user's checked-out branch implicitly.","triggerScenarios":"Running an update where the destination checkout is on branch X (e.g. `main`) while the transferred repository's HEAD branch is Y (e.g. `master` or a renamed branch).","commonSituations":"Source repo renamed its default branch (master→main) but destination still sits on the old name; user manually checked out a feature branch in the config repo; fresh clones elsewhere default to a different branch.","solutions":["Switch the destination to the transferred branch: `git -C <destination> checkout <transferred-branch>`.","Rename the destination branch to match: `git -C <destination> branch -m <old> <transferred-branch>`.","Align the source repository so its checked-out branch matches what the destination expects (e.g. keep `main` everywhere).","If the old branch is obsolete, fast-forward it to the transferred branch first, then switch."],"exampleFix":"// before: destination on 'master', transfer branch is 'main'\ngit -C ~/.config/mise branch -m master main\n// after: branch matches the transferred branch; rerun with --update","handlingStrategy":"validation","validationCode":"const branch = execFileSync('git', ['-C', dest, 'symbolic-ref', '--short', 'HEAD']).toString().trim();\nconst expected = 'main'; // branch of the transferred bundle\nif (branch !== expected) throw new Error(`destination on ${branch}, transfer expects ${expected}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize one default branch name across all clones of the config repo.","Avoid manually checking out feature branches in the destination checkout.","After a default-branch rename upstream, run `git branch -m` in existing clones."],"tags":["git","branch-mismatch","configuration"],"backgroundTag":"invalid-state-transition","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}