Docs: HEAD / default branch section · Entire

Docs: HEAD / Default Branch

c25015d→main·

Adds a "HEAD / Default Branch" section to usage.md covering:

JSON Output section adds sourceHead to the documented keys.

Refs #45.

Changes

1

HEAD / Default Branch

git-sync surfaces the source's symref HEAD target — the source's default branch — in result output:

$ git-sync probe --json <source-url> | jq .sourceHead
"refs/heads/main"

Bootstrap pushes the source HEAD's branch first. On hosts that pick the default branch from the first push to a fresh repo (GitHub, GitLab, others), this makes the mirror's default branch match the source without any manual step. No flag needed — the ordering is always applied.

git's wire protocol has no command for updating a remote symref, so for hosts that don't infer the default from first-push (raw bare repos, some self-hosted setups), the default branch has to be set out of band:

  1. Match the default at init time — git init --bare --initial-branch=<source-default> on the target before the first sync.
  2. Set HEAD post-sync — git symbolic-ref HEAD refs/heads/<source-default> on the bare repo, or the host's API/UI (GitHub PATCH /repos/{owner}/{repo} with default_branch; GitLab PUT /projects/:id with default_branch).

JSON Output

Add --json to any command to emit machine-readable output instead of the default text format.