Skip to content

[Git] Narrow fetched remote branches while preserving the personal fork #3

Description

@tannerpolley

Objective

Reduce remote-branch noise in the T3 Code source-control picker for the personal tannerpolley/t3code fork while preserving the ability to select and work from intentionally retained remote branches.

This issue is for the tannerpolley/t3code fork only. It does not request an upstream pull request.

Verified current state

The local clone currently uses the personal fork as origin:

origin = https://github.com/tannerpolley/t3code.git
remote.origin.fetch = +refs/heads/*:refs/remotes/origin/*

The wildcard fetch refspec imports every branch that exists on the fork into local origin/* remote-tracking refs. This is the reason the T3 source-control picker can contain a large collection of origin/agent/*, archive, and other branches.

A fork and a clone should remain separate concepts:

  • Keep the GitHub fork as origin for pushes and personal branches.
  • A clone is only the local checkout and is not a replacement for the fork.
  • Add an upstream remote only if upstream synchronization is needed.
  • Git does not know which branches were personally authored; an inherited branch is still an origin/* branch once it exists on the fork.

Requested plan and implementation

First inspect the current checkout, active worktrees, dirty state, default branch, and branches used by active agents. Do not prune or rewrite refspecs while doing so.

Then:

  1. Keep origin pointed at tannerpolley/t3code.
  2. Replace the broad +refs/heads/* fetch policy with an explicit allowlist of branches that the user actually needs, at minimum the default branch and any active feature branches.
  3. If an upstream remote is introduced, fetch only its default branch unless the user explicitly adds more.
  4. Prune unselected local remote-tracking refs only after the retained branch list is confirmed.
  5. Preserve normal pushes, including git push -u origin <new-branch>.
  6. Ensure automatic fetches do not reintroduce the wildcard refspec.
  7. Keep remote branch selection available in T3 for retained branches.
  8. Document the difference between:
    • hiding remote branches in the T3 UI;
    • stopping their local fetch;
    • deleting branches from the GitHub fork.
  9. Do not delete any GitHub branch as part of this issue.

The existing T3 contract has local/remote/all ref filtering, but the current branch picker does not provide a useful allowlist or remote-name preference. Decide explicitly whether the smallest safe solution is Git configuration only, a T3 picker preference, or both. Do not add a UI abstraction if the Git refspec alone solves the user's problem.

Acceptance criteria

  • origin remains the personal fork and remains usable for pushes.
  • The final remote.origin.fetch configuration no longer fetches every branch through an unrestricted wildcard.
  • git branch -r contains only the retained origin/* tracking refs after pruning.
  • The default branch and every active branch required by current work remain available.
  • A newly created local branch can still be pushed with normal upstream tracking.
  • T3's source-control picker continues to show local branches and intentionally retained remote branches.
  • Refreshing T3 or running its normal fetch path does not restore the removed remote-tracking refs.
  • No GitHub-hosted branches are deleted.
  • Recovery instructions are recorded for adding another branch back to the fetch allowlist.

Non-goals

  • Do not remove or recreate the GitHub fork.
  • Do not change the upstream repository.
  • Do not delete stale branches from GitHub.
  • Do not modify unrelated T3 source-control behavior.
  • Do not touch the active GitHub Issues implementation.
  • Do not submit an upstream pull request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions