{"record":{"id":"06c666834a539643","repo":"pcottle/learnGitBranching","slug":"ref-is-not-a-remote-branch","errorCode":null,"errorMessage":"' + ref + ' is not a remote branch","messagePattern":"' \\+ ref \\+ ' is not a remote branch","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/git/commands.js","lineNumber":79,"sourceCode":"var assertIsBranch = function(engine, ref) {\n  assertIsRef(engine, ref);\n  var obj = engine.resolveID(ref);\n  if (!obj || obj.get('type') !== 'branch') {\n    throw new GitError({\n      msg: intl.todo(\n        ref + ' is not a branch'\n      )\n    });\n  }\n};\n\nvar assertIsRemoteBranch = function(engine, ref) {\n  assertIsRef(engine, ref);\n  var obj = engine.resolveID(ref);\n\n  if (obj.get('type') !== 'branch' ||\n      !obj.getIsRemote()) {\n    throw new GitError({\n      msg: intl.todo(\n        ref + ' is not a remote branch'\n      )\n    });\n  }\n};\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  }","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/commands.js#L61-L97","documentation":"assertIsRemoteBranch throws when the ref resolves but is not a branch with getIsRemote() true — i.e. it isn't a remote-tracking branch like o/main. Used by commands that specifically operate on remote branches.","triggerScenarios":"Passing a local branch ('main') or a tag where a remote branch ('o/main', or 'main' resolved against origin) is required, e.g. git fetch/push configs that call assertIsRemoteBranch on engine.origin refs.","commonSituations":"Forgetting the o/ prefix in LearnGitBranching remote levels; assuming origin resolution is automatic.","solutions":["Prefix the branch with the remote, e.g. o/main","Run git fetch first so the remote-tracking ref exists","Check engine.origin.resolveID(ref) before calling"],"exampleFix":"// before\ngit branch -d main --remote\n// after\ngit branch -d o/main --remote  (i.e. target the remote-tracking ref)","handlingStrategy":"type-guard","validationCode":"var obj = engine.resolveID(ref); if (!obj || obj.get('type') !== 'branch' || !obj.getIsRemote()) return;","typeGuard":"function isRemoteBranchRef(engine, ref) { var o = engine.resolveID(ref); return !!o && o.get('type') === 'branch' && !!o.getIsRemote(); }","tryCatchPattern":null,"preventionTips":["Prefix remote branches with o/ in UI hints","Filter branch lists by getIsRemote() for remote-only commands"],"tags":["git","remote","branch"],"backgroundTag":"not-a-remote-branch","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}