{"record":{"id":"9da6ab1663eed68d","repo":"gitbutlerapp/gitbutler","slug":"cannot-push-branch-the-push-would-include","errorCode":null,"errorMessage":"Cannot push branch '{}': the push would include {} conflicted commit{}.\nConflicted commits: {}\nPlease resolve conflicts before pushing using 'but resolve <commit>'.","messagePattern":"Cannot push branch '(.+?)': the push would include (.+?) conflicted commit(.+?)\\.\nConflicted commits: (.+?)\nPlease resolve conflicts before pushing using 'but resolve <commit>'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/push.rs","lineNumber":1264,"sourceCode":"                .map(|c| c.id)\n                .collect();\n            // Only pay for the map when the error actually prints.\n            let id_map = (!conflicted.is_empty())\n                .then(|| crate::IdMap::legacy_new_from_context(ctx).ok())\n                .flatten();\n            let conflicted_commits: Vec<String> = conflicted\n                .iter()\n                .map(|id| {\n                    id_map\n                        .as_ref()\n                        .and_then(|id_map| id_map.change_id_ref(*id))\n                        .map(|change_id| change_id.padded_short_id())\n                        .unwrap_or_else(|| shorten_object_id(&repo, *id))\n                })\n                .collect();\n\n            if !conflicted_commits.is_empty() {\n                return Err(anyhow::anyhow!(\n                    \"Cannot push branch '{}': the push would include {} conflicted commit{}.\\n\\\n                         Conflicted commits: {}\\n\\\n                         Please resolve conflicts before pushing using 'but resolve <commit>'.\",\n                    branch_name,\n                    conflicted_commits.len(),\n                    if conflicted_commits.len() == 1 {\n                        \"\"\n                    } else {\n                        \"s\"\n                    },\n                    conflicted_commits.join(\", \")\n                ));\n            }\n\n            return Ok(());\n        }\n    }\n","sourceCodeStart":1246,"sourceCodeEnd":1282,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/push.rs#L1246-L1282","documentation":"Before pushing, the CLI checks the branch and its stack ancestors for conflicted commits; any hit aborts the push with the count (pluralized) and a short-id list (change ids where the IdMap knows them, otherwise shortened oids). The message directs to `but resolve <commit>` because publishing conflict markers to a remote is never wanted.","triggerScenarios":"Pushing a branch whose stack contains commits still marked conflicted — typically after `but pull` integrated upstream changes and the conflicts were left unresolved.","commonSituations":"Pull brought conflicting upstream changes and the user pushed without finishing resolution; long-lived stacks integrated onto a moved target; CI attempting to push mid-conflict.","solutions":["Run `but resolve <commit>` for each commit listed in the error and complete conflict resolution","Verify the stack is clean with `but status` and `but push --dry-run`","Push again once no conflicted commits remain"],"exampleFix":"# before\nbut push feature-x\n# error: Cannot push branch 'feature-x': the push would include 2 conflicted commits...\n\n# after\nbut resolve <short-id-from-error>   # repeat for each listed commit\nbut push feature-x","handlingStrategy":"validation","validationCode":"# Preview before pushing — dry-run surfaces conflicts without touching the remote\nbut push --dry-run || { echo 'resolve conflicts first: but resolve <commit>' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"# Extract the conflicted-commit list and drive resolution\nout=$(but push 2>&1); rc=$?\nif [ $rc -ne 0 ] && [[ \"$out\" == *\"conflicted commit\"* ]]; then\n  # ids follow 'Conflicted commits:' in the message — feed each to `but resolve`\n  echo \"$out\" | sed -n 's/.*Conflicted commits: //p'\nfi","preventionTips":["Always dry-run after a conflict-heavy pull","Finish `but resolve` sessions before switching tasks or pushing","Treat the conflicted-commit list in the error as your worklist"],"tags":["push","merge-conflicts","resolve","stack"],"backgroundTag":"merge-conflicts-unresolved","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}