{"record":{"id":"f330b6e90573c805","repo":"pcottle/learnGitBranching","slug":"git-error-options","errorCode":null,"errorMessage":"git-error-options","messagePattern":"git-error-options","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/git/commands.js","lineNumber":143,"sourceCode":"var commandConfig = {\n  commit: {\n    sc: /^(gc|git ci)($|\\s)/,\n    regex: /^git +commit($|\\s)/,\n    description: 'Record changes to the repository',\n    options: [\n      '--amend',\n      '-a',\n      '--all',\n      '-am',\n      '-m'\n    ],\n    execute: function(engine, command) {\n      var commandOptions = command.getOptionsMap();\n      command.acceptNoGeneralArgs();\n\n      if (commandOptions['-am'] && (\n          commandOptions['-a'] || commandOptions['--all'] || commandOptions['-m'])) {\n        throw new GitError({\n          msg: intl.str('git-error-options')\n        });\n      }\n\n      var msg = null;\n      var args = null;\n      var stageAll = !!(commandOptions['-a'] || commandOptions['--all'] ||\n        commandOptions['-am']);\n      if (stageAll && !engine.changesModelEngaged) {\n        // classic levels have no real staging, so -a is a no-op worth flagging\n        command.addWarning(intl.str('git-warning-add'));\n      }\n\n      if (commandOptions['-am']) {\n        args = commandOptions['-am'];\n        command.validateArgBounds(args, 1, 1, '-am');\n        msg = args[0];\n      }","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/commands.js#L125-L161","documentation":"The commit command rejects combining -am with -a, --all, or -m. Real git treats -am as shorthand, so this guard throws git-error-options when both the compound flag and its components are present.","triggerScenarios":"git commit -am 'msg' -m 'other' or git commit -am --all 'msg' in the simulator.","commonSituations":"Shell alias or script that already passes -am and appends extra flags; copying long commands from docs.","solutions":["Use only -am 'msg' and drop the duplicate flags","Or use plain -m with a separate git add"],"exampleFix":"// before\ngit commit -am 'msg' -m 'extra'\n// after\ngit commit -am 'msg'","handlingStrategy":"validation","validationCode":"if (opts['-am'] && (opts['-a'] || opts['--all'] || opts['-m'])) { delete opts['-a']; delete opts['--all']; delete opts['-m']; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Canonicalize flags before executing commands","Don't stack redundant commit flags in aliases"],"tags":["git","commit","options","mutually-exclusive"],"backgroundTag":"conflicting-command-options","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}