Skip to main content
OpenSourceAlternatives

Linguist

Open source · OSI-approvedStatus: unknownNew

Language detection library behind GitHub language stats and code highlighting

Linguist is the open source library that decides which languages GitHub reports for a repository, powering the familiar language stats bar, syntax highlighting, and diff behaviour on GitHub.com. It serves maintainers of polyglot repositories, documentation-heavy projects, and anyone whose repository shows the wrong dominant language.[1][2]

Quick verdict

Teams whose GitHub language bar misrepresents their repository benefit most from Linguist's override system. Its documented detection pipeline, from modelines to Bayesian classification, gives maintainers a concrete correction path through committed gitattributes. The material constraint is skill and surface: overrides demand a developer comfortable with gitattributes and a local Ruby toolchain for verification. If your stats are wrong, add linguist overrides rather than restructuring your repository; if you need language detection outside Ruby or GitHub, embed the library or run its CLI locally.[1][2][3]

Key features

  • Ordered detection pipeline Each file passes through modeline, common filename, shell shebang, extension, XML header, man-page section, heuristics, and naive Bayesian classification, with each step narrowing the candidates.[1]

  • Byte-based language stats Repository percentages come from bytes of code per language through the repository languages API, so large generated files cannot silently dominate once excluded.[1]

  • Vendored and generated exclusions Known third-party and machine-produced paths are left out of statistics, and generated files are additionally suppressed in diffs.[1][2]

  • Committed gitattributes overrides The linguist-language, linguist-vendored, linguist-generated, linguist-documentation, and linguist-detectable attributes correct classification per path once committed.[1]

  • Detectable-type control Data and prose languages stay out of statistics by default but can be opted in per path, which suits projects such as hardware designs with meaningful non-code files.[1]

  • Repository and single-file CLI The github-linguist executable analyses whole checkouts by percentage and bytes, accepts any git revision with --rev, and switches to per-file analysis when given a file path.[1]

  • Embeddable Ruby API Applications instantiate Linguist::Repository over a Rugged repository object and read back the dominant language and the full byte map.[1]

  • MIT-licensed gem distribution The github-linguist gem ships github-linguist and git-linguist executables with documented charlock_holmes, mini_mime, and rugged dependencies.[1][2]

Who will love it

  • Maintainers of polyglot repositories: per-file classification with byte-based percentages keeps the stats bar honest when a project mixes languages, grammars, and generated output.[1]

  • Teams fighting a wrong dominant language: committed linguist-vendored and linguist-language attributes fix the bar without moving files or rewriting history.[1]

  • Ruby tool builders: the library API and CLI give detection, breakdowns, and revision-scoped analysis to embed in dashboards, linters, or migration tooling.[1]

Who should avoid it

  • Non-technical site owners: overrides require editing and committing gitattributes, so anyone without a developer should ask one rather than adopt the tool directly.[1]

  • Teams needing hosted language analytics: there is no Linguist cloud service or dashboard; it is a local library and CLI plus GitHub's built-in background analysis.[1][2]

  • Projects outside the Ruby and git workflow: verifying results locally needs a Ruby toolchain with native dependencies, which is friction for teams standardised elsewhere.[1]

Alternatives and compatibility

If GitHub mislabels your repository, keep the repository layout and add committed linguist overrides, since the documented pipeline plus overrides resolves the reported cases.[1][2]

If you need detection in your own product rather than on GitHub.com, embed the MIT-licensed library or script the CLI; no substitutable catalogue alternative is currently evidenced.[1][2]

Treat the stats bar as a cached snapshot of the default branch, updated when the repository changes rather than a live measure of effort.[1]

Questions worth asking

What is the best Linguist alternative for non-technical users?

There is no simpler alternative to evaluate: non-technical users should keep GitHub's automatic stats and ask a developer to add the documented gitattributes overrides, since no substitutable catalogue product is evidenced.[1]

Is Linguist really no-code?

No. Reading the stats bar needs no code, but correcting it means writing gitattributes rules and committing them, and local verification needs a Ruby install with native dependencies.[1][2]

How much does Linguist cost per month?

Nothing. The MIT-licensed gem has no plan, seat, or usage billing, checked October 2026; the only cost is the developer time to configure overrides and install dependencies.[1][2]

Can you self-host Linguist?

Yes, in the library sense: it runs entirely in your own environment against local checkouts via the gem, CLI, or source build, with no hosted component or edition restrictions to consider.[1][2]

Sources and editorial review

Source research. Reviewed on October 11, 2026. Written by Sanjib Sah. AI assisted; reviewed by a human editor.

We have not run or tested this product.

  1. Linguist README (github-linguist/linguist)

    official · Observed October 11, 2026

    Canonical README: GitHub.com use, gem install, native dependencies, Ruby application usage, CLI repository and single-file modes with --rev and --breakdown.

  2. How Linguist works (official docs)

    official · Observed October 11, 2026

    Detection pipeline: languages.yml, ordered strategies from modeline to naive Bayes, binary/vendored/generated/documentation/data/prose exclusions, byte-based percentages, background analysis of the default branch.

  3. Linguist overrides (official docs)

    official · Observed October 11, 2026

    Override attributes (linguist-language, linguist-vendored, linguist-generated, linguist-documentation, linguist-detectable) with committed-.gitattributes semantics driving stats and highlighting.

  4. github-linguist gemspec (official)

    official · Observed October 11, 2026

    Gem identity: name github-linguist, MIT licence, GitHub authorship, runtime deps charlock_holmes/mini_mime/rugged, github-linguist and git-linguist executables.

  5. github-linguist/linguist repository page

    official · Observed October 11, 2026

    Identity anchor: github/linguist resolves to github-linguist/linguist (Language Savant); contribution path is a pull request against misreported languages.

Compared with these products

No explicit proprietary baseline is recorded.

Similar projects

Related projects with shared categories, technologies, or licensing.

OpenCode

OpenCodeAIOpen

AI coding agent for terminal, editor, and desktop

Stars202.9K
Commit8h ago
LicenseMIT

OpenCode is an MIT-licensed AI coding agent available through terminal, desktop, and IDE clients. It supports hosted providers and local models. Code handling depends on the selected provider; optional session sharing uploads conversation history to OpenCode's sharing service.

Pi

PiAIOpen

Extensible terminal AI coding agent with model choice and tree-structured sessions

Stars114.5K
Commitjust now
LicenseMIT

Pi is an extensible terminal AI coding agent with a small core, multi-provider model choice, tree sessions, and a TypeScript extension system.

Gitea

GiteaOpen

Self-hosted Git service with code review, CI, and package registries

Stars58.3K
Commitjust now
LicenseMIT

Gitea is a self-hosted Git service with code hosting, review, issues, pull requests, Actions-compatible CI, and package registries in one lightweight binary.

Aider

AiderAIOpen

Terminal pair-programming assistant that edits codebases with LLMs

Stars49.3K
Commit3mo ago
LicenseApache-2.0

Aider is a terminal-based pair-programming tool that applies LLM-suggested edits directly to files in new or existing codebases.

Gogs

GogsOpen

Painless self-hosted Git service with a tiny resource footprint

Stars47.9K
Commitjust now
LicenseMIT

Gogs is a self-hosted Git service written in Go that ships as a single binary with repository hosting, issues, pull requests, and a wiki.

Bruno

BrunoOpen

Open-source API client that stores collections as plain-text files

Stars47.3K
Commitjust now
LicenseMIT

Bruno is an open-source desktop API client that stores collections as plain-text Bru files on your filesystem, so teams can version them in Git.