{"record":{"id":"3848f5f2c4b19d66","repo":"pcottle/learnGitBranching","slug":"branchname-is-not-a-branch","errorCode":null,"errorMessage":"' + branchName + ' is not a branch!","messagePattern":"' \\+ branchName \\+ ' is not a branch!","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/git/commands.js","lineNumber":103,"sourceCode":"};\n\nvar assertOriginSpecified = function(generalArgs) {\n  if (!generalArgs.length) {\n    return;\n  }\n  if (generalArgs[0] !== 'origin') {\n    throw new GitError({\n      msg: intl.todo(\n        generalArgs[0] + ' is not a remote in your repository! try adding origin to that argument'\n      )\n    });\n  }\n};\n\nvar assertBranchIsRemoteTracking = function(engine, branchName) {\n  branchName = crappyUnescape(branchName);\n  if (!engine.resolveID(branchName)) {\n    throw new GitError({\n      msg: intl.todo(branchName + ' is not a branch!')\n    });\n  }\n  var branch = engine.resolveID(branchName);\n  if (branch.get('type') !== 'branch') {\n    throw new GitError({\n      msg: intl.todo(branchName + ' is not a branch!')\n    });\n  }\n\n  var tracking = branch.getRemoteTrackingBranchID();\n  if (!tracking) {\n    throw new GitError({\n      msg: intl.todo(\n        branchName + ' is not a remote tracking branch! I don\\'t know where to push'\n      )\n    });\n  }","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/commands.js#L85-L121","documentation":"assertBranchIsRemoteTracking first unescapes the branch name and throws this GitError when engine.resolveID returns null — the branch does not exist at all in the engine.","triggerScenarios":"Calling a push/fetch config that runs assertBranchIsRemoteTracking with a typo'd or nonexistent branch name, e.g. git push origin maain.","commonSituations":"Typos; branch was never created; branch exists only on origin and was never fetched.","solutions":["Create or fetch the branch first (git branch / git fetch)","Double-check spelling against git branch output"],"exampleFix":"// before\ngit push origin feautre\n// after\ngit push origin feature","handlingStrategy":"validation","validationCode":"var name = crappyUnescape(branchName); if (!engine.resolveID(name)) { /* create/fetch or reject */ }","typeGuard":"function branchExists(engine, name) { return !!engine.resolveID(crappyUnescape(name)); }","tryCatchPattern":null,"preventionTips":["Autocomplete branch names instead of free-text input","git fetch before pushing to new branches"],"tags":["git","branch","push"],"backgroundTag":"branch-not-found","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}