Overview
Bruno’s file-based approach makes it perfect for version control with Git. Since collections are stored as plain text.bru files in folders on your filesystem, you can use Git (or any version control system) to track changes, collaborate with your team, and maintain a history of your API development.
Bruno stores your collections directly in a folder on your filesystem using a plain text markup language (Bru) to save information about API requests. This design choice makes version control natural and seamless.
Why Git + Bruno?
Plain Text Format
.bru files are human-readable text files that work perfectly with Git’s diff and merge capabilitiesOffline-First
No cloud sync means your data stays on your device and in your Git repository
Team Collaboration
Multiple team members can work on the same collection using Git workflows
Change History
Track every change to your API requests with full Git history
Setting Up Git for Your Collection
1
Initialize Git repository
Navigate to your collection folder and initialize Git:
2
Create .gitignore
Create a
.gitignore file to exclude sensitive data:.gitignore
3
Add collection files
Add your collection files to Git:
4
Push to remote
Push to GitHub, GitLab, or your preferred Git hosting:
Collection Structure in Git
Here’s what a typical Bruno collection looks like in a Git repository:Managing Secrets with Git
Bruno provides avars:secret block to mark sensitive variables:
Local.bru
Environment File Strategy
Option 1: Template FilesProduction.bru
Production.secrets.bru
Collaborative Workflows
Feature Branch Workflow
1
Create feature branch
2
Add new requests
Create new
.bru files for your endpoints:3
Commit changes
4
Push and create PR
5
Review and merge
Team members can review the
.bru files in the PR, test the requests, and merge when ready.Reviewing Changes
Git diffs of.bru files are human-readable:
Branching Strategies
GitFlow for API Collections
Environment-Based Branches
Some teams use branches for different environments:Merge Conflicts
Because.bru files are plain text with clear block structure, conflicts are easy to resolve:
Git Hooks for Collections
Pre-commit Hook: Validate .bru Files
Create.git/hooks/pre-commit:
Pre-commit Hook: Check for Secrets
README for Your Collection
Create a comprehensive README for your collection repository:README.md
CI/CD Integration
Running Collections in CI
Use Bruno CLI to run collections in your CI pipeline:.github/workflows/api-tests.yml
GitLab CI Example
.gitlab-ci.yml
Best Practices
Semantic Commits
Use conventional commits:
feat:, fix:, docs:, refactor:Atomic Commits
One logical change per commit (e.g., one endpoint or related group)
Descriptive Names
Name
.bru files clearly: create-user.bru, list-posts.bruCode Review
Review
.bru files in PRs just like codeDocumentation
Keep README.md updated with collection structure and setup
Templates
Commit
.example files for environment templatesProtect Secrets
Use
.gitignore and vars:secret to prevent leaking credentialsOrganize Folders
Use logical folder structure that mirrors your API
Migrating from Other Tools
If you’re migrating from Postman or Insomnia:1
Export from current tool
Export your collection as JSON
2
Import to Bruno
Use Bruno’s import feature to convert to
.bru format3
Initialize Git
Set up Git repository as described above
4
Commit and push
Commit the imported collection and push to your Git hosting
Example: Team Workflow
Here’s how a team might use Bruno with Git:Next Steps
Collections
Learn more about organizing your collections
Environments
Master environment and variable management
CLI
Run collections from the command line
Testing
Add tests to validate your APIs