A browser script that adds a total line count badge to GitHub repositories.
- Displays total lines of code directly on repository pages
- Works with both public and private repositories
- Lightweight and non-intrusive
- Install a userscript manager like Tampermonkey
- Install the script
- (Optional) Open the menu of the userscript manager and configure a GitHub Personal Access Token for higher rate limits:
- Requires
public_reposcope for public repositories - Requires
reposcope for private repositories - For fine-grained personal access tokens, select "Public repositories" or "All repositories" under "Repository access" as needed
- Requires
Since GitHub does not provide a direct API to get the total line count of a repository, the script calculates approximate line counts by combining:
Note:
- Results may vary slightly from exact counts
- Very large repositories may not be supported
- Add support for linguistic detection (i.e., ignore vendored or generated code)
- Add support for mobile device views
