mislav/hub · error
the current branch '%s' doesn't seem pushed to a remote
Error message
the current branch '%s' doesn't seem pushed to a remote
What it means
In commands/compare.go compare, for the branch-based compare path, the tool first tries findPushTarget(currentBranch) and falls back to deducePushTarget(currentBranch, host.User). If both fail, it cannot determine where the current branch is published and aborts with "the current branch '%s' doesn't seem pushed to a remote".
Source
Thrown at commands/compare.go:94
var r string
flagCompareBase := args.Flag.Value("--base")
if args.IsParamsEmpty() {
currentBranch, err := localRepo.CurrentBranch()
if err != nil {
utils.Check(command.UsageError(err.Error()))
}
var remoteBranch *github.Branch
var remoteProject *github.Project
remoteBranch, remoteProject, err = findPushTarget(currentBranch)
if err != nil {
if remoteProject, err = deducePushTarget(currentBranch, host.User); err == nil {
remoteBranch = currentBranch
} else {
utils.Check(fmt.Errorf("the current branch '%s' doesn't seem pushed to a remote", currentBranch.ShortName()))
}
}
r = remoteBranch.ShortName()
if remoteProject.SameAs(mainProject) {
if flagCompareBase == "" && remoteBranch.IsMaster() {
utils.Check(fmt.Errorf("the branch to compare '%s' is the default branch", remoteBranch.ShortName()))
}
} else {
r = fmt.Sprintf("%s:%s", remoteProject.Owner, r)
}
if flagCompareBase == r {
utils.Check(fmt.Errorf("the branch to compare '%s' is the same as --base", r))
} else if flagCompareBase != "" {
r = fmt.Sprintf("%s...%s", flagCompareBase, r)
}
} else {View on GitHub (pinned to 5c547ed804)
Solutions
- Push the branch first: `git push -u origin <branch>`, then rerun `hub compare`.
- Set an upstream explicitly: `git branch --set-upstream-to=origin/<branch>`.
- Verify the remote is a recognizable GitHub remote (`git remote -v`); add/fix origin if needed.
- Pass the branch explicitly, e.g. `hub compare <branch>`, to bypass push-target deduction.
Example fix
// before hub compare // current branch 'feature' doesn't seem pushed to a remote // after git push -u origin feature hub compare feature
Defensive patterns
Strategy: validation
Validate before calling
# before running hub compare, ensure the branch is pushed
branch=$(git rev-parse --abbrev-ref HEAD)
git ls-remote --heads origin "$branch" | grep -q "$branch" || \
{ echo "push first: git push -u origin $branch"; exit 1; } Try / catch
remoteBranch, remoteProject, err := findPushTarget(currentBranch)
if err != nil {
if remoteProject, err = deducePushTarget(currentBranch, host.User); err != nil {
return fmt.Errorf("push branch first: git push -u origin %s", currentBranch.ShortName())
}
} Prevention
- Always `git push -u origin <branch>` when creating branches
- Set upstream tracking before running remote-dependent commands
- Keep origin pointing at a valid GitHub remote
- Pass the branch explicitly to compare when unsure of push state
When it happens
Trigger: Running `hub compare` while on a local branch that has no upstream tracking branch and cannot be matched to a remote project on the host (findPushTarget and deducePushTarget both return errors).
Common situations: On a brand-new local branch never pushed; branch created from a remote ref but never committed/pushed; working in a repo cloned over a protocol/remote layout hub cannot map to a GitHub project; detached or misconfigured remote named something other than origin.
Related errors
- the branch to compare '%s' is the default branch
- the branch to compare '%s' is the same as --base
- Can't find remote for %s
- Aborted: no revision could be determined from '%s'
- Error: %s/%s doesn't have a wiki
AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01).
Data as JSON: /api/errors/ec5feb660fdc6b36.
Report an issue: GitHub.