Skip to content

feat: make git remote name configurable instead of hard-coding 'origin' #2

@bhagyamudgal

Description

@bhagyamudgal

Context

Raised in PR #1 review (comment). Currently the tool hard-codes origin as the remote name in several places:

  • gitFetch() in src/lib/git.tsgit fetch origin --prune
  • create command in src/commands/create.tsorigin/${opts.name} branch lookups and origin/${base} fallback

This breaks workflows where the primary remote is named something other than origin (e.g., upstream, main).

Proposed Solution

Add an optional REMOTE key to .worktreerc config (defaulting to origin):

DEFAULT_BASE=origin/dev
REMOTE=origin

Then use the configured remote name throughout:

  • gitFetch(remote) instead of gitFetch() with hard-coded origin
  • Branch lookups use ${remote}/${name} instead of origin/${name}

Files to Change

  • src/lib/config.ts — add REMOTE to config schema with default "origin"
  • src/lib/git.tsgitFetch accepts a remote parameter
  • src/commands/create.ts — use config.REMOTE instead of "origin" string literals

Notes

Deferred from PR #1 as it requires coordinated changes across config, git wrappers, and the create command. Not a bug — origin is the standard convention — but a useful enhancement for non-standard setups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions