{"record":{"id":"6853bb3933d5a2cd","repo":"mislav/hub","slug":"unknown-revision-or-path-not-in-the-working-tree","errorCode":null,"errorMessage":"Unknown revision or path not in the working tree: %s","messagePattern":"Unknown revision or path not in the working tree: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"git/git.go","lineNumber":136,"sourceCode":"func Head() (string, error) {\n\treturn SymbolicRef(\"HEAD\")\n}\n\n// SymbolicRef reads a branch name from a ref such as \"HEAD\"\nfunc SymbolicRef(ref string) (string, error) {\n\trefCmd := gitCmd(\"symbolic-ref\", ref)\n\trefCmd.Stderr = nil\n\toutput, err := refCmd.Output()\n\treturn firstLine(output), err\n}\n\n// SymbolicFullName reads a branch name from a ref such as \"@{upstream}\"\nfunc SymbolicFullName(name string) (string, error) {\n\tparseCmd := gitCmd(\"rev-parse\", \"--symbolic-full-name\", name)\n\tparseCmd.Stderr = nil\n\toutput, err := parseCmd.Output()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Unknown revision or path not in the working tree: %s\", name)\n\t}\n\n\treturn firstLine(output), nil\n}\n\nfunc Ref(ref string) (string, error) {\n\tparseCmd := gitCmd(\"rev-parse\", \"-q\", ref)\n\tparseCmd.Stderr = nil\n\toutput, err := parseCmd.Output()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Unknown revision or path not in the working tree: %s\", ref)\n\t}\n\n\treturn firstLine(output), nil\n}\n\nfunc RefList(a, b string) ([]string, error) {\n\tref := fmt.Sprintf(\"%s...%s\", a, b)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/git/git.go#L118-L154","documentation":"SymbolicFullName() resolves a symbolic ref name (typically \"@{upstream}\") to its full ref path with `git rev-parse --symbolic-full-name <name>`. When rev-parse fails, the library replaces the underlying error with this message naming the input ref, meaning the name cannot be resolved as a revision or ref in the current repo.","triggerScenarios":"Calling git.SymbolicFullName(\"@{upstream}\") (via sync or Upstream) when the current branch has no upstream configured, the upstream branch was deleted, or the ref name doesn't exist.","commonSituations":"New local branch never pushed (no upstream set); remote-tracking ref pruned after the remote branch was deleted; running on a detached HEAD where @{upstream} is meaningless.","solutions":["Set an upstream: git push -u origin <branch> or git branch --set-upstream-to=origin/<branch>","Confirm the ref resolves with `git rev-parse --symbolic-full-name @{upstream}`","If the remote branch was deleted, choose another upstream or re-push","Check you are on a branch, not detached HEAD, before calling"],"exampleFix":"// before\nfull, err := git.SymbolicFullName(\"@{upstream}\")\n// after\nfull, err := git.SymbolicFullName(\"@{upstream}\")\nif err != nil {\n    return fmt.Errorf(\"branch has no upstream; run: git push -u origin %s\", branch)\n}","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"git\", \"rev-parse\", \"--abbrev-ref\", \"--symbolic-full-name\", \"@{upstream}\").Output()\nhasUpstream := err == nil && len(strings.TrimSpace(string(out))) > 0","typeGuard":null,"tryCatchPattern":"full, err := git.SymbolicFullName(\"@{upstream}\")\nif err != nil {\n    return fmt.Errorf(\"no upstream for current branch; run `git push -u origin <branch>`\")\n}","preventionTips":["Always push with -u to set upstream for new branches","Verify upstream exists with git rev-parse @{upstream} before syncing","Avoid @{upstream} on detached HEAD","Prune stale remotes and re-set upstream after force-deletes"],"tags":["git","ref","upstream","branch"],"backgroundTag":"unknown-revision","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}