Skip to main content
KiCad welcomes contributions via merge requests on GitLab. This guide will help ensure your contribution can be accepted quickly.

Before You Start

Discuss Large Changes

If you are planning a large change or new feature:
  1. Post to the developer mailing list before you begin substantial work
  2. Check if anyone else is working on it
  3. Ensure it fits into the overall development plans
  4. Get feedback on your approach
This prevents wasted effort and ensures your contribution aligns with KiCad’s direction.

Start Small

New contributors should start with: Gradually work your way up to larger features as you gain familiarity with the codebase.

General Guidelines

1. Use Feature Branches

Always create a new branch for merge requests instead of using your fork’s master branch.
git checkout -b feature/descriptive-name
Good branch names:
  • fix/pcbnew-crash-on-export
  • feature/add-svg-export
  • refactor/simplify-footprint-loading

2. Follow Code Style

Ensure your code follows the KiCad Code Style Guide:
  • Use clang-format for formatting
  • Follow naming conventions
  • Match the existing code style in files you modify
  • Run format checks before submitting
clang-format -i your_modified_file.cpp

3. Follow UI Guidelines

If you are making User Interface changes, follow the User Interface Guidelines:
  • Consistent dialog layouts
  • Proper keyboard shortcuts
  • Accessibility considerations
  • Use wxWidgets sizers appropriately

4. Write Good Commit Messages

Commit messages should: Use a descriptive first line:
Add SVG export support to PCB editor
Not:
Updated files
Provide details in the body:
Add SVG export support to PCB editor

Implements SVG export with the following features:
- Layer selection dialog
- Configurable stroke width
- Optional drill marks
- Page size options

Fixes #12345
Reference issues:
  • Use Fixes #123 to automatically close issues
  • Use Related to #123 for related issues

5. Descriptive Merge Request Titles

Give merge requests a short and descriptive title that summarizes the major changes:
  • ✅ “Add support for IPC-2581 file import”
  • ✅ “Fix crash when exporting Gerber with missing layers”
  • ✅ “Refactor symbol library loading for better performance”
  • ❌ “Updates”
  • ❌ “Fix bug”
  • ❌ “Changes to pcbnew”

6. Detailed Descriptions

The merge request description should contain:
  • What changed
  • Why it changed
  • How to test it
  • Screenshots for UI changes
  • Related issues or discussions
Example:
## Summary

Adds support for importing IPC-2581 format files into the PCB editor.

## Changes

- New IPC2581 parser in `pcbnew/import/`
- Import menu entry and dialog
- Unit tests for parser
- Documentation updates

## Testing

1. Open PCB editor
2. File → Import → IPC-2581
3. Select test file from `qa/data/ipc2581/`
4. Verify layers and components load correctly

## Screenshots

![Import Dialog](screenshot.png)

Fixes #12345

GitLab Configuration

Configure Your Fork

Before submitting merge requests, configure your personal fork:

1. Enable CI/CD Visibility

Settings → General → Visibility → CI/CD
  • Set to “Everyone with access”
  • This allows reviewers to see your pipeline results

2. Set Pipeline Timeout

Settings → CI/CD → General pipelines
  • Set timeout to 3 hours or longer
  • KiCad builds can take time, especially on GitLab shared runners

3. Allow Maintainer Commits

When creating your merge request:
  • ✅ Check “Allow commits from members who can merge to the target branch” (bottom of MR form)
  • This allows maintainers to make minor fixes directly

Creating a Merge Request

Step 1: Prepare Your Branch

# Ensure you're on your feature branch
git checkout feature/my-feature

# Rebase on latest master
git fetch upstream
git rebase upstream/master

# Run tests
cd build/debug
ctest --output-on-failure

# Format code
clang-format -i path/to/modified/files.cpp

# Commit any formatting fixes
git add .
git commit -m "Apply code formatting"

Step 2: Push to Your Fork

git push origin feature/my-feature
If you rebased:
git push --force-with-lease origin feature/my-feature

Step 3: Create the Merge Request

  1. Go to https://gitlab.com/kicad/code/kicad/-/merge_requests/new
  2. Select your fork and branch as source
  3. Select kicad/code/kicad and master as target
  4. Fill in the template:
    • Title
    • Description
    • Related issues
  5. ✅ Check “Allow commits from members who can merge to the target branch”
  6. Submit

CI Pipeline

When you create or update a merge request, the CI pipeline automatically runs:

Build Tests

  • Linux build
  • Windows build
  • macOS build (if applicable)

Code Quality Checks

  • Format check (clang-format)
  • Compiler warnings
  • Build without errors

Unit Tests

  • All QA tests must pass
  • ctest results are checked

What If CI Fails?

Format Check Failure

# Apply formatting
clang-format -i modified_files.cpp

# Commit and push
git add .
git commit -m "Apply code formatting"
git push origin feature/my-feature

Build Failure

  • Check the CI logs for error messages
  • Fix the issue locally first
  • Test locally before pushing
  • Ask for help on the merge request if stuck

Test Failure

# Run tests locally
cd build/debug
ctest --output-on-failure

# Fix failing tests
# Commit and push fixes

Code Review Process

What to Expect

  1. Automated checks run immediately (CI pipeline)
  2. Maintainer review - A KiCad maintainer will review your code
  3. Feedback - You may receive comments and change requests
  4. Iteration - Make requested changes and push updates
  5. Approval - Once approved, a maintainer will merge your MR

Responding to Feedback

  • Be responsive to reviewer comments
  • Ask questions if you don’t understand feedback
  • Make requested changes promptly
  • Push updates to the same branch (don’t close and create new MRs)
# Make changes based on feedback
vim file.cpp

# Commit changes
git add file.cpp
git commit -m "Address review feedback: Fix memory leak"

# Push to update MR
git push origin feature/my-feature

Resolving Discussions

  • Resolve discussions after addressing comments
  • Use the “Resolve discussion” button on GitLab
  • Add a comment explaining your changes

Common Issues and Solutions

Merge Conflicts

If your branch has conflicts with master:
# Update your local master
git checkout master
git pull upstream master

# Rebase your feature branch
git checkout feature/my-feature
git rebase master

# Resolve conflicts in your editor
# After resolving:
git add resolved_files
git rebase --continue

# Force push (with lease for safety)
git push --force-with-lease origin feature/my-feature

Format Check Disagreements

If clang-format suggests changes you disagree with:
  1. Check the Code Style Guide for exceptions
  2. Rule 7: Follow existing file formatting when in doubt
  3. Comment on the MR explaining why you deviated
  4. Maintainers will provide guidance

CI Timeout

If your CI pipeline times out:
  1. Check your fork’s pipeline timeout setting (should be 3+ hours)
  2. Consider splitting large changes into smaller MRs
  3. Contact maintainers if issues persist

Best Practices

Keep Changes Focused

  • One feature or fix per merge request
  • Don’t mix refactoring with feature changes
  • Don’t include unrelated formatting changes

Write Tests

When adding new features:
// Add unit tests in qa/tests/
TEST_CASE( "My new feature", "[module]" )
{
    // Test code
    REQUIRE( result == expected );
}

Update Documentation

If your change affects user-facing features:
  • Update relevant documentation
  • Add comments to complex code
  • Update Doxygen comments

Keep Commits Clean

Option 1: Squash Before Merging
  • Maintainers may squash your commits when merging
Option 2: Clean History
# Interactive rebase to clean up commits
git rebase -i upstream/master

# Follow prompts to squash/reword commits

Test on Multiple Platforms

If possible, test your changes on:
  • Linux
  • Windows
  • macOS
At minimum, ensure CI passes on all platforms.

After Your MR is Merged

Update Your Local Repository

# Switch to master
git checkout master

# Pull latest changes (including your merged MR)
git pull upstream master

# Push to your fork
git push origin master

# Delete your feature branch (optional)
git branch -d feature/my-feature
git push origin --delete feature/my-feature

Celebrate! 🎉

Your code is now part of KiCad! Your contribution helps thousands of users worldwide.

Getting Help

If you need assistance:

Additional Resources

Contributor Recognition

All contributors are recognized in:
  • AUTHORS.txt file in the repository
  • KiCad’s About dialog
  • Release notes for major contributions
Thank you for contributing to KiCad!

Build docs developers (and LLMs) love