Skip to content

Add subcommand branch show-base#118

Open
guettli wants to merge 2 commits into
git-pkgs:mainfrom
guettli:add-show-base-branch
Open

Add subcommand branch show-base#118
guettli wants to merge 2 commits into
git-pkgs:mainfrom
guettli:add-show-base-branch

Conversation

@guettli
Copy link
Copy Markdown
Contributor

@guettli guettli commented Jun 8, 2026

Description

Resolves #115.

Introduces a local caching layer for the resolved base (target) branch of local feature branches, avoiding redundant Forge API network calls.

Changes

  1. Caching Logic: Added the git package with GetOrFetchBaseBranch to check for and set branch.<branch>.forge-merge-base in .git/config.
  2. Subcommand: Added forge branch show-base [branch] (with -r/--refresh flag to bypass/update the cache).
  3. Automatic Cache Updates:
    • forge pr checkout: Caches base branch for the checked-out branch.
    • forge pr create: Caches base branch for the source branch.
    • forge pr view: Caches base branch if the source branch exists locally.
  4. Tests: Added unit tests in git_test.go and CLI command validation.

Introduces a local caching layer for the resolved
base (target) branch of local feature branches,
avoiding redundant Forge API network calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Local caching for base/target branch resolution

1 participant