{"record":{"id":"b7200a04ff955212","repo":"denoland/deno","slug":"aborting-due-to-uncommitted-changes-check-in-sour","errorCode":null,"errorMessage":"Aborting due to uncommitted changes. Check in source code or run with --allow-dirty","messagePattern":"Aborting due to uncommitted changes\\. Check in source code or run with --allow-dirty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/publish/mod.rs","lineNumber":200,"sourceCode":"      publish_configs,\n    )\n    .await?;\n\n  diagnostics_collector.print_and_error()?;\n\n  if prepared_data.package_by_name.is_empty() {\n    bail!(\"No packages to publish\");\n  }\n\n  if std::env::var(\"DENO_TESTING_DISABLE_GIT_CHECK\")\n    .ok()\n    .is_none()\n    && !publish_flags.allow_dirty\n    && let Some(dirty_text) =\n      check_if_git_repo_dirty(cli_options.initial_cwd()).await\n  {\n    log::error!(\"\\nUncommitted changes:\\n\\n{}\\n\", dirty_text);\n    bail!(\n      \"Aborting due to uncommitted changes. Check in source code or run with --allow-dirty\"\n    );\n  }\n\n  if publish_flags.dry_run {\n    for (_, package) in prepared_data.package_by_name {\n      log::info!(\n        \"{} of {} with files:\",\n        colors::green_bold(\"Simulating publish\"),\n        colors::gray(package.display_name()),\n      );\n      for file in &package.tarball.files {\n        log::info!(\"   {} ({})\", file.specifier, human_size(file.size as f64),);\n      }\n    }\n    log::warn!(\"{} Dry run complete\", colors::green(\"Success\"));\n    return Ok(());\n  }","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/publish/mod.rs#L182-L218","documentation":"Before uploading, `deno publish` verifies the git repository is clean so every published version maps to a checkable commit. If the worktree has uncommitted changes and neither `--allow-dirty` nor the `DENO_TESTING_DISABLE_GIT_CHECK` env var applies, it prints the change summary via `log::error!` and aborts. The check runs against the repo containing the initial cwd.","triggerScenarios":"Running `deno publish` (no `--allow-dirty`) while `check_if_git_repo_dirty` finds the tree differs from HEAD — uncommitted edits, staged changes, or untracked files counted by git status.","commonSituations":"CI pipelines that generate files (lockfiles, dist output, changelogs) before the publish step; local releases where the version bump was edited but not committed; bots mutating the tree.","solutions":["Commit or stash the changes first: `git add -A && git commit -m \"chore: release\"`.","If the dirtiness is expected (CI-generated artifacts), re-run with `deno publish --allow-dirty`.","Add generated paths to .gitignore so they stop marking the tree dirty in future runs."],"exampleFix":"# before\ndeno publish   # error: uncommitted changes\n# after\ngit add -A && git commit -m \"chore: release v1.2.3\" && deno publish\n# or, in CI with generated files:\ndeno publish --allow-dirty","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nif [ -n \"$(git status --porcelain)\" ]; then\n  echo \"dirty worktree — commit, stash, or use --allow-dirty\" >&2\n  git status --porcelain >&2\n  exit 1\nfi\ndeno publish","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit the version bump before publishing (release scripts: bump → commit → publish).","Add CI-generated files (lockfiles, dist, changelogs) to .gitignore so runs stay clean.","When dirtiness is expected and harmless, make `--allow-dirty` explicit in the pipeline instead of debugging the abort."],"tags":["publish","git","dirty-worktree","allow-dirty"],"backgroundTag":"uncommitted-changes","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}