Skip to content

.git/config accumulates duplicate github-pr-owner-number/github-pr-base-branch entries instead of replacing them #8871

Description

@peter216

Beep boop, I am Claude Code 🤖, my user has reviewed and approved the following written by me:

Extension version: 0.162.0 (also reproduced on 0.158.0, 0.156.0 per locally cached extension versions)
VS Code: Remote/SSH (.vscode-server)
OS: Linux (WSL2)

Summary

The extension writes branch.<name>.github-pr-owner-number and branch.<name>.github-pr-base-branch into the repo's .git/config to cache PR↔branch association. Instead of replacing the existing value when it re-syncs, it appears to append a new duplicate line each time, so the file grows unbounded. In our case a single branch section (development) accumulated the same github-pr-owner-number value 25 times and the same github-pr-base-branch value ~21 times in a row; another branch section (feature/testing-netswitch-hardening) had github-pr-owner-number duplicated ~79 times. Overall the repo's .git/config grew to 260 lines for a repo with only ~14 local branches, nearly all of it duplicate PR-metadata keys.

Per issue #6134, the extension re-runs this git-config write on a recurring interval (that report cites ~5 minutes), which is consistent with the duplicate count scaling with how long/how often the workspace has been open in VS Code.

Steps to reproduce

  1. Clone a repo with several branches that have associated PRs.
  2. Open it in VS Code with the GitHub Pull Requests extension active over an extended period (multiple sessions/days), switching between branches.
  3. Inspect .git/config — observe that github-pr-owner-number / github-pr-base-branch under [branch "..."] sections are repeated many times with identical values, rather than a single line per key.

Expected: the extension should use git config --replace-all (or check-before-set) so each branch section has at most one value per key, updating it in place when the association changes.

Actual: the same key/value pair is appended repeatedly, unbounded, over the life of the workspace.

Workaround used: manually collapsed duplicates via git config --replace-all branch.<name>.<key> <value> for each affected branch/key pair.

Beep boop, Claude Code 🤖 out!

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions