---
title: "Update Git Configuration"
method: PATCH
path: "/api/v1/git/config"
tags: ["Git Configuration"]
---

# Update Git Configuration

`PATCH /api/v1/git/config`

## Request

- Base URL: `https://public-api.linearb.io`
- URL: `https://public-api.linearb.io/api/v1/git/config`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/linearb/apis/linearb-api/docs/api/v1/git/config/patch.ts> (a function with typed inputs; its response is checked against the schema)

Writes the organization-wide default of each section sent; sections not sent are left as they are. Repositories that override a section are unaffected. Changing excluded branches, excluded base branches, excluded file extensions, release detection or coding time strategy recomputes history asynchronously, and so does changing included file extensions

## Request body

- GitSettingsWriteModel
  - `releases_detection` ReleasesDetectionWriteModel: How releases are detected. Changing it recomputes history asynchronously.
    - `method` 'tags' | 'pr_to_branch' | 'merge_to_branch' | 'api', required: `tags`, `pr_to_branch`, `merge_to_branch` or `api`
    - `pattern` string, nullable: Regular expression for the release tags (`tags`) or the dedicated branch (`pr_to_branch`, `merge_to_branch`); required for those, not allowed with `api`
    - `backfill_days` 1 | 90: How far back history is recomputed after this change: `90` (default) recomputes the last 90 days, `1` skips the recompute. The recompute runs asynchronously
  - `draft_pull_requests` DraftPullRequestsModel: How draft pull requests are recognized; a pull request matching either rule is a draft.
    - `labels` string[]: Labels that mark a pull request as a draft (case-insensitive)
    - `title_pattern` string, nullable: Regular expression matched against the title; `null` or empty: no title rule
  - `default_branch` DefaultBranchModel: The branch every merge comparison is based on.
    - `branch_name` string, nullable: `null` uses the provider's default branch
  - `exclude_branches` PatternsModel: A list of regular expressions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry
  - `exclude_base_branches` PatternsModel: A list of regular expressions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry
  - `exclude_file_extensions` PatternsModel: A list of regular expressions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry
  - `coding_time_strategy` CodingTimeStrategyWriteModel: When coding time starts. Changing it recomputes history asynchronously.
    - `method` 'first_commit' | 'issue_state_pr', required: `first_commit`: the first commit on the branch; `issue_state_pr`: the linked issue moving to in progress
    - `backfill_days` 1 | 90: How far back history is recomputed after this change: `90` (default) recomputes the last 90 days, `1` skips the recompute. The recompute runs asynchronously
  - `bot_pr_attribution` BotPrAttributionModel: Who a pull request opened by a bot is attributed to.
    - `method` 'merge_actor' | 'assignee' | 'none', required: `merge_actor`: whoever merged it; `assignee`: its assignees; `none`: left on the bot
  - `include_file_extensions` IncludeFileExtensionsModel: The files scanned: only files matching one of the patterns, out of those left after the excluded file extensions. Changing it recomputes history asynchronously.
    - `patterns` string[]: Regular expressions, one per entry; `.*$` includes every file
  - `active_branches_duration` ActiveBranchesDurationWriteModel: How long a branch stays active after its last update before it becomes stale.
    - `days` 3 | 7 | 14, required: Days: `3`, `7` or `14`, as Company Settings offers
  - `issue_start_time` IssueStartTimeModel: Which transition to the in progress state is the issue start time; it affects coding time and MTTR.
    - `method` 'first_transition' | 'last_transition', required: `first_transition`: the first move to in progress; `last_transition`: the last one

## Response `200`

Successful Response

- GitConfigResponseModel: The organization-wide default of every repository setting section, and the organization-wide only sections.
  - `settings` GitSettingsModel, required: The organization-wide Git setting sections.
    - `releases_detection` ReleasesDetectionModel, required: How releases are detected.
      - `method` 'tags' | 'pr_to_branch' | 'merge_to_branch' | 'api' | 'deployment', required: `tags`: release tags; `pr_to_branch`: pull requests to a dedicated branch; `merge_to_branch`: direct merges to a dedicated branch; `api`: releases reported via the API. `deployment` is read-only
      - `pattern` string, nullable: Regular expression for the release tags (`tags`) or the dedicated branch (`pr_to_branch`, `merge_to_branch`); required for those, not allowed with `api`
    - `draft_pull_requests` DraftPullRequestsModel, required: How draft pull requests are recognized; a pull request matching either rule is a draft.
      - `labels` string[]: Labels that mark a pull request as a draft (case-insensitive)
      - `title_pattern` string, nullable: Regular expression matched against the title; `null` or empty: no title rule
    - `default_branch` DefaultBranchModel, required: The branch every merge comparison is based on.
      - `branch_name` string, nullable: `null` uses the provider's default branch
    - `exclude_branches` PatternsModel, required: A list of regular expressions. Changing it recomputes history asynchronously.
      - `patterns` string[]: Regular expressions, one per entry
    - `exclude_base_branches` PatternsModel, required: A list of regular expressions. Changing it recomputes history asynchronously.
      - `patterns` string[]: Regular expressions, one per entry
    - `exclude_file_extensions` PatternsModel, required: A list of regular expressions. Changing it recomputes history asynchronously.
      - `patterns` string[]: Regular expressions, one per entry
    - `coding_time_strategy` CodingTimeStrategyModel, required: When coding time starts.
      - `method` 'first_commit' | 'issue_state_pr', required: `first_commit`: the first commit on the branch; `issue_state_pr`: the linked issue moving to in progress
    - `bot_pr_attribution` BotPrAttributionModel, required: Who a pull request opened by a bot is attributed to.
      - `method` 'merge_actor' | 'assignee' | 'none', required: `merge_actor`: whoever merged it; `assignee`: its assignees; `none`: left on the bot
    - `include_file_extensions` IncludeFileExtensionsModel, required: The files scanned: only files matching one of the patterns, out of those left after the excluded file extensions. Changing it recomputes history asynchronously.
      - `patterns` string[]: Regular expressions, one per entry; `.*$` includes every file
    - `active_branches_duration` ActiveBranchesDurationModel, required: How long a branch stays active after its last update before it becomes stale.
      - `days` integer, required: Days, from 3 to 14
    - `issue_start_time` IssueStartTimeModel, required: Which transition to the in progress state is the issue start time; it affects coding time and MTTR.
      - `method` 'first_transition' | 'last_transition', required: `first_transition`: the first move to in progress; `last_transition`: the last one

## Other responses

- `400`: Bad Request - an unknown section, an invalid value or regular expression
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `405`: Method Not Allowed
- `409`: Conflict
- `422`: Validation Error
- `500`: Internal Server Error
- `504`: Gateway Timeout

---

[API](https://skmtc.dev/linearb/apis/linearb-api.md) - [All operations](https://skmtc.dev/linearb/apis/linearb-api/llms.txt) - [OpenAPI document](https://skmtc.dev/linearb/apis/linearb-api/revisions/3aea06710db6?raw)
