Skip to content

[FEATURE] Detect unpushed commits on non-current branches #53

Description

@nilp0inter

What problem does this solve?

CheckRepoState (internal/gitx/gitx.go) computes status only against <remote>/<currentBranch>, where the branch comes from git branch --show-current. Commits stranded on any other local branch are never examined.

So "I did work on feature/x, switched back to main, and forgot to push feature/x" is invisible — the scan only ever looks at whatever branch happens to be checked out.

Proposed solution

Enumerate all local branches and report unpushed/unpulled status per branch. A single network-free call covers it:

git for-each-ref \
  --format='%(refname:short)%09%(upstream:short)%09%(upstream:track,nobracket)' \
  refs/heads

Combine with git rev-list --count <branch> --not --remotes for a fetch-free unpushed count that also handles the no-upstream case (related issue).

Surface per-branch status in report.RepoState (e.g. Branches []BranchStatus) so JSON and TUI can show which branch is unpushed. This also delivers the existing roadmap item "Show branches with their states on each repo."

Out of scope

  • Detection of the no-upstream case in isolation (separate issue, though the implementation here naturally fixes it too).
  • Performing the push.

Split off from #46.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions