Branch Workflow
Branch Workflow
This document describes the branching strategy and workflow for pass-cli development.
Branch Structure
main Branch
- Purpose: Production-ready code and active development
- Protection: Requires PR review and passing CI checks
- Updates: Via pull requests from feature/spec branches
- Default: Yes (users cloning repo get this)
- Tags: All release tags are created on main
- CI: Runs on every push and PR
Daily Workflow
Starting Work
# Clone repo (if new)
git clone https://github.com/arimxyer/pass-cli.git
cd pass-cli
# Make sure you're up to date
git pull origin mainMaking Changes
For features and bug fixes:
# Create a feature branch from main
git checkout -b feat/my-feature-name
# Make your changes
# ... edit files ...
# Commit frequently with clear messages
git add .
git commit -m "feat: add new feature"
# Push your branch
git push origin feat/my-feature-name
# Create PR via GitHub
# Go to: https://github.com/arimxyer/pass-cli/compare/main...feat/my-feature-name
# CI runs automatically on your PRFor spec work:
# Create a spec branch
git checkout -b spec/001-feature-name
# Implement the spec (commit after each task/phase)
git commit -m "feat: implement spec phase 1"
git commit -m "test: add tests for spec requirements"
git commit -m "docs: update spec completion report"
# Push and create PR
git push origin spec/001-feature-name
# Create PR with spec completion summaryCreating Pull Requests
- Push your branch to origin
- Go to GitHub and create a pull request to
main - CI runs automatically - lint, tests, security scan, build
- Wait for CI to pass (required before merge)
- Review changes if needed
- Merge PR when CI is green
After Merge
# Update your local main
git checkout main
git pull origin main
# Delete your local feature branch (optional)
git branch -d feat/my-feature-nameBranch Naming Conventions
- Features:
feat/descriptive-nameorfeature/descriptive-name - Bug fixes:
fix/issue-description - Specs:
spec/NNN-feature-name - Hotfixes:
hotfix/critical-bug - Experiments:
exp/experiment-name
Release Process
When ready to release:
# Ensure main is clean and CI passing
git checkout main
git pull origin main
# Run full test suite locally
go test ./...
go test -v -tags=integration -timeout 5m ./test
# Create and push release tag
git tag -a v0.x.x -m "Release v0.x.x: Brief description"
git push origin v0.x.x
# Release workflow runs automaticallyThe release workflow will:
- Run full CI suite (tests, lint, security)
- Build binaries for all platforms
- Create GitHub release with artifacts
- Update package manifests (Homebrew, Scoop)
Branch Protection
Main Branch Protection
Enabled protections:
- [OK] Require pull request before merging
- [OK] Require status checks to pass:
Detect Code ChangesLintUnit TestsIntegration Tests (ubuntu-latest)Integration Tests (macos-latest)Integration Tests (windows-latest)Security ScanBuild
- [OK] Block force pushes
- [OK] Restrict deletions
- [OK] Repository admins can bypass (for emergency fixes)
Result: All changes require PR and passing CI. Direct pushes blocked.
CI/CD Pipeline
On Feature Branch Push
Feature branch push → No CI (saves compute time)On PR to main
PR created → CI runs automatically (lint, tests, security, build)
→ PR shows CI status
→ Merge blocked until CI passesSmart filtering: CI skips test jobs when only non-code files change (docs/, specs/, .md files).
On Merge to main
PR merged → main branch updated → CI runs on main (verification)On Release Tag
Tag pushed to main (v*) →
Release workflow runs →
Build binaries for all platforms →
Create GitHub release →
Update Homebrew tap →
Update Scoop bucketEmergency Hotfixes
For critical production bugs:
# Create hotfix branch from main
git checkout -b hotfix/critical-bug main
# Fix the bug
# ... make changes ...
git commit -m "fix: critical security vulnerability"
# Push and create PR
git push origin hotfix/critical-bug
# Create PR: hotfix/critical-bug → main
# Expedite review and merge
# After merge, tag release immediately
git checkout main
git pull origin main
git tag v0.x.x
git push origin v0.x.xCommon Commands
Check Which Branch You’re On
git branch --show-currentSee Recent Commits on Main
git log main --oneline -10Compare Your Branch With Main
git diff main..HEADUpdate Your Branch With Latest Main
# While on your feature branch
git fetch origin
git rebase origin/main
# Or if you prefer merging
git merge origin/mainList All Branches
git branch -aDelete Merged Feature Branches
# Delete local branch
git branch -d feat/my-feature
# Delete remote branch
git push origin --delete feat/my-featureTips
- Always work on feature branches - Don’t work directly on main
- Commit frequently - Small, focused commits are better
- Test locally first - Run
go test ./...before pushing - Write clear PR descriptions - Explain what and why
- Keep PRs focused - One feature/fix per PR
- Rebase before PR - Keep history clean with
git rebase origin/main - Delete branches after merge - Keep repo tidy
Troubleshooting
“Cannot Push to Main” Error
This is expected! Create a pull request from your feature branch instead.
# If you accidentally committed to main locally
git branch feat/my-feature # Create branch from current main
git reset --hard origin/main # Reset main to match remote
git checkout feat/my-feature # Switch to your feature branch
# Now push and create PRPR Has Merge Conflicts
# Update your branch with latest main
git checkout your-feature-branch
git fetch origin
git rebase origin/main
# Resolve conflicts in your editor
# After resolving each file:
git add <resolved-file>
git rebase --continue
# Push updated branch
git push origin your-feature-branch --force-with-leaseCI Failing on Your PR
# Pull the latest changes from your PR branch
git checkout your-feature-branch
git pull origin your-feature-branch
# Fix the failing tests/linting locally
go test ./...
golangci-lint run
# Commit the fixes
git commit -m "fix: resolve CI failures"
git push origin your-feature-branch
# CI will automatically re-run on the PRForgot to Create Feature Branch
# If you made changes directly on main
git stash # Save your changes
git checkout -b feat/my-feature # Create feature branch
git stash pop # Apply your changes
git add .
git commit -m "feat: description"
git push origin feat/my-featureReferences
- GitHub Actions: https://github.com/arimxyer/pass-cli/actions
- Branch Settings: https://github.com/arimxyer/pass-cli/settings/rules
- Release Workflow:
.github/workflows/release.yml - CI Workflow:
.github/workflows/ci.yml - Pull Requests: https://github.com/arimxyer/pass-cli/pulls