Development Environment
Setting up a local Porch development environment
This guide explains how to set up your Git environment and contribute code to Porch.
Porch uses a fork-based workflow. This protects the upstream repository from accidental changes and ensures all modifications go through the pull request review process.
This creates a copy of the Porch repository under your GitHub account (e.g., github.com/YOUR_USERNAME/porch).
Clone your fork using SSH (required for pushing changes):
git clone git@github.com:YOUR_USERNAME/porch.git
cd porch
SSH authentication links your commits to your GitHub account, which is required for CLA verification. If you haven’t set up SSH keys, see GitHub’s SSH documentation.
Add the upstream repository and prevent accidental pushes to it:
git remote add upstream https://github.com/nephio-project/porch.git
git remote set-url --push upstream no_push
Verify your remotes:
git remote -v
Expected output:
origin git@github.com:YOUR_USERNAME/porch.git (fetch)
origin git@github.com:YOUR_USERNAME/porch.git (push)
upstream https://github.com/nephio-project/porch.git (fetch)
upstream no_push (push)
Before creating a new branch, sync your fork’s main branch with upstream:
git checkout main
git fetch upstream
git rebase upstream/main
git push origin main
Do this regularly to keep your fork up to date.
Create a branch for your changes:
git checkout -b feature-add-package-validation
Branch naming conventions:
feature- - New featuresfix- - Bug fixesrefactor- - Code refactoringdocs- - Documentation changesmake check, make test and make test-e2eIf you have added any new golang files, add this golang copyright header to each new golang file you have added. If you have added any other files (Yaml, scripts, test data), add this text copyright header file to each new file.
If you have updated existing files, amend the dates on the copyright notice. Assuming you are updating the code in 2026, use the following guide.
| Existing dates | New Dates |
|---|---|
| 2026 | 2026 |
| 2025 | 2025-2026 |
| 2024 | 2024, 2026 |
| 2023 | 2023, 2026 |
| 2025-2026 | 2025-2026 |
| 2024-2026 | 2024-2026 |
| 2022-2026 | 2022-2026 |
| 2022-2025 | 2022-2026 |
| 2022-2024 | 2022-2024, 2026 |
| 2018-2020,2022-2025 | 2018-2020,2022-2026 |
| 2018-2020,2022-2024 | 2018-2020,2022-2024,2026 |
| … | … |
git add .
git commit -sm "feat: add package validation for lifecycle transitions"
Commit message format:
feat: - New featurefix: - Bug fixrefactor: - Code refactoringtest: - Test changesdocs: - Documentationchore: - Maintenance tasksUse imperative mood (“add” not “added”).
Push your branch to your fork (origin):
git push origin feature-add-package-validation
The EasyCLA bot will prompt you to sign the CLA if you haven’t already (see Before You Start).
If maintainers request changes:
git commit -sm "fix: address review feedback"git push origin feature-add-package-validationThe PR will automatically update with your new commits.
If your PR becomes outdated with the main branch:
git checkout feature-add-package-validation
git fetch upstream
git rebase upstream/main
git push origin feature-add-package-validation --force-with-lease
Use --force-with-lease instead of --force for safer force-pushing.
Clean up your local and remote branches:
git checkout main
git fetch upstream
git rebase upstream/main
git push origin main
git branch -d feature-add-package-validation
git push origin --delete feature-add-package-validation
git checkout main
git checkout feature/my-feature
git status
git branch -a # List all branches
git checkout -- <file> # Discard changes to specific file
git reset --hard # Discard all local changes
git log --oneline
git log --graph --oneline --all
If you encounter Git issues:
Setting up a local Porch development environment