{"record":{"id":"787ad62f1a097252","repo":"jdx/mise","slug":"global-configuration-has-uncommitted-changes","errorCode":null,"errorMessage":"global configuration has uncommitted changes","messagePattern":"global configuration has uncommitted changes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":257,"sourceCode":"        }\n    }\n    git(&checkout, &[\"remote\", \"set-url\", \"origin\", origin])?;\n    let branch = git(&checkout, &[\"symbolic-ref\", \"--short\", \"HEAD\"])?;\n    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 {","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/remote_repository.rs#L239-L275","documentation":"install_at detected uncommitted changes (`git status --porcelain`, tracked files only) in an existing Git checkout at the destination before applying the transferred global configuration. The tool refuses to overwrite a dirty worktree because the operation could destroy or mix local edits. It requires a clean checkout before any update or comparison proceeds.","triggerScenarios":"Installing/updating a global-config repository into a destination that already has a `.git` and modified or staged-but-uncommitted tracked files (untracked files are ignored, tracked modifications are not).","commonSituations":"User hand-edited their global config.toml without committing; an editor or tool auto-modified tracked files; a merge/rebase was left in progress leaving staged changes.","solutions":["Run `git -C <destination> status` and commit the changes: `git add -A && git commit -m \"local changes\"`.","Stash instead of committing: `git -C <destination> stash --include-untracked`.","Discard unwanted edits: `git -C <destination> checkout -- .` (after verifying nothing valuable is lost).","Move uncommitted work to the source repository, push it, and re-run the transfer so the bundle contains those changes."],"exampleFix":"// before: install fails with dirty worktree\ngit -C ~/.config/mise status --porcelain   # shows M config.toml\ngit -C ~/.config/mise add -A && git -C ~/.config/mise commit -m \"sync local edits\"\n// after: worktree is clean; rerun the install","handlingStrategy":"validation","validationCode":"const dest = process.env.HOME + '/.config/mise';\nif (fs.existsSync(path.join(dest, '.git'))) {\n  const status = execFileSync('git', ['-C', dest, 'status', '--porcelain', '--untracked-files=no']).toString();\n  if (status.length > 0) throw new Error('destination worktree is dirty; commit or stash first');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit or stash before running any install/update of the global config.","Automate a pre-check `git status --porcelain --untracked-files=no` in scripts.","Treat the config repo as machine-managed: edit via the source repo, not in place."],"tags":["git","dirty-worktree","configuration"],"backgroundTag":"git-command-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}