A command-line tool to fetch and export code review data from GitHub, GitLab or Azure Devops merge requests.
⚠️ Requires node 20+
⚠️ For Azure Devops, changes extraction requires local git installation
node git.cjs [options]-k, --git-token <token>: Git authentication token (GitHub or GitLab personal access token)-f, --from <date>: Start date in ISO 8601 format (e.g., "2024-01-01")-r, --repositories <repos>: Comma-separated list of repositories to fetch from (e.g., "owner/repo1,owner/repo2")
--no-diff: Disable code diff export in the output-p, --git-provider <provider>: Git provider to use - "github", "gitlab" or "azure-devops" (defaults to "gitlab")-u, --git-url <url>: Custom Git URL for self-hosted instances-o, --output <file>: Output JSON file path (defaults to "comments.json")-i, --includes <include>: Comma-separated list of glob patterns to filter files in diffs--max-retries <retries>: Maximum number of retries for failed requests (defaults to 3)-v, --verbose: Enable verbose logging
Fetch GitLab merge requests from the last month:
node git.cjs \
-k your_gitlab_token \
-u https://gitlab.example.com \
-f 2024-02-01 \
-r group/project1,group/project2 \
-o output.jsonFetch GitHub PRs with specific file types:
node git.cjs \
-k your_github_token \
-f 2024-01-01 \
-p github \
-r owner/repo \
-i "*.ts,*.js" \
-o github_prs.jsonFetch azure-devops PRs with verbose logging:
node git.cjs \
-k your_azure_devops_token \
-f 2024-01-01 \
-p azure-devops \
-r organization/project \
-vThe -i, --includes option accepts glob patterns to filter which files should be included in the diff output. Multiple patterns can be specified as a comma-separated list.
Examples of include patterns:
# Only TypeScript files
-i "*.ts"
# TypeScript and JavaScript files
-i "*.ts,*.js"
# Files in src directory and its subdirectories
-i "src/**/*"
# Specific file types in specific directories
-i "src/**/*.ts,test/**/*.spec.ts"
# Multiple specific paths
-i "src/models/*.ts,src/controllers/*.js,*.json"The tool will only include diffs from files that match at least one of the specified patterns. If no includes are specified, all files will be included in the output.
The tool generates a JSON file containing merge request data including:
- Basic PR/MR information (title, description, author)
- Creation and merge dates
- Code changes (unless --no-diff is specified)
- File changes matching include patterns (if specified)
Generate a personal access token with api scope at: GitLab > Settings > Access Tokens
Generate a personal access token with repo scope at: GitHub > Settings > Developer settings > Personal access tokens
Generate a personal access token with Code (read) scope at: Azure Devops > User settings > Personal access tokens