Skip to content

feat: add dynamic default branch resolution#83

Merged
Huerte merged 1 commit into
mainfrom
feat/dynamic-branch-init
Jun 2, 2026
Merged

feat: add dynamic default branch resolution#83
Huerte merged 1 commit into
mainfrom
feat/dynamic-branch-init

Conversation

@Huerte

@Huerte Huerte commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • New feature
  • Documentation
  • Refactor / internal

Overview

The gitgo link and init commands use your actual default branch. It stops hardcoding "master". It checks your global init.defaultBranch first. Then it checks gitgo.default-branch. If both are missing, it just uses main.

Changes

  • config.py: Added get_default_branch() to run git config --get init.defaultBranch.
  • git_core.py & link.py: Replaced the hardcoded fallbacks with get_default_branch().
  • tests: Added test_get_default_branch_* for the native config, gitgo config, and hard fallback.
  • CHANGELOG.md: Added the new feature to the Unreleased section.

How to Test

  1. pip install -e ".[dev]"
  2. Set a custom git default branch: git config --global init.defaultBranch custom-branch
  3. Run gitgo link in a new empty repo.
  4. Expected result: GitGo initializes the repo using custom-branch instead of main or master.

Checklist

  • I tested my changes locally and they work
  • I updated CHANGELOG.md under the [Unreleased] section
  • I updated README.md (if I added or changed a command)
  • I added or updated tests for my change (if applicable)
  • My change does not break any existing commands (if it does, describe the impact in the Overview)

@Huerte Huerte merged commit 23dcfed into main Jun 2, 2026
1 check passed
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.

1 participant