RMAgent uses a gitflow workflow to manage development. This guide will walk you through the daily workflow, from starting a new feature to merging it into production.
📚 New to git or team collaboration? See git-for-newbies.md for:
git pullvsgit fetchexplained- How feature branches relate to develop
- Multi-developer sync strategies
- Common collaboration scenarios
main Production-ready code (protected)
↑
PR (merge commit)
|
develop Integration branch (default)
↑
PR (squash merge)
|
feature/* Individual features
-
main: Production-ready code only. Protected - no direct commits allowed.
- Requires PR with 1 approving review
- Requires all status checks to pass (linting + tests)
- Requires branch to be up-to-date before merge
- No force pushes or deletions allowed
- Enforced for administrators
-
develop: Default working branch. Protected - all features merge here first.
- Requires PR (self-merge allowed for solo dev)
- Requires all status checks to pass (linting + tests)
- No force pushes or deletions allowed
- Admins can bypass in emergencies
-
feature/: Individual features. Branch from develop, PR back to develop.
- No protection - you can commit directly and force push if needed
- Still requires PR to merge into develop
Always start from an up-to-date develop branch:
# Make sure you're on develop
git checkout develop
# Get latest changes
git pull origin develop
# Create a new feature branch
git checkout -b feature/my-feature-name
# Push the branch to GitHub
git push -u origin feature/my-feature-nameBranch Naming Convention: feature/description-with-dashes
Examples:
feature/census-extractionfeature/add-source-validationfeature/fix-date-parsing
Make commits as you normally would:
# Make changes to your files
# Stage changes
git add .
# Commit with descriptive message
git commit -m "feat: add census extraction parser"
# Push to GitHub
git pushCommit Message Convention:
feat:- New featurefix:- Bug fixdocs:- Documentation onlytest:- Adding or updating testsrefactor:- Code refactoringchore:- Maintenance tasks
Pre-Commit Hook (Automatic):
When you commit, a pre-commit hook automatically checks if key documentation files need updating:
⚠️ DOCUMENTATION REVIEW REMINDER
This commit may require updates to key documentation files:
• Documentation structure changed
Please review and update if necessary:
📄 CLAUDE.md - Project overview, structure, key patterns
📄 README.md - User-facing docs, badges, quick start
✓ AGENTS.md - Already modified
The hook will ask you to confirm before proceeding. This ensures CLAUDE.md, README.md, and AGENTS.md stay current.
When your feature is ready:
# Make sure all changes are committed and pushed
git status
git push
# Create PR using GitHub CLI
gh pr create --base develop --title "feat: add census extraction" --body "Description of changes"Or create the PR through GitHub web interface.
PR Checklist:
- All tests pass locally (
uv run pytestor/test) - Code is formatted (
uv run black .or/lint fix) - No linting errors (
uv run ruff check .or/lint) - Changes are documented (if needed)
- Pre-commit hook reviewed (auto-runs on commit)
- CLAUDE.md, README.md, AGENTS.md updated if needed
Once tests pass on GitHub Actions:
# Merge using GitHub CLI (squash merge)
gh pr merge --squash --delete-branch
# Or use GitHub web interface with "Squash and merge" buttonThen update your local develop:
git checkout develop
git pull origin developWhen you've completed a milestone from AI_AGENT_TODO.md:
# Make sure develop is up to date
git checkout develop
git pull origin develop
# Create PR to main
gh pr create --base main --title "Release: Milestone X Complete" --body "Summary of changes"
# Review and merge with "Create a merge commit" (not squash)
gh pr merge --merge# Save your current work
git add .
git commit -m "wip: partial implementation"
git push
# Switch to different feature
git checkout feature/other-feature
# Or start a new one
git checkout develop
git pull
git checkout -b feature/new-featureIf develop has new changes you need:
# On your feature branch
git checkout feature/my-feature
# Get latest develop
git fetch origin develop
# Merge develop into your feature
git merge origin/develop
# Resolve any conflicts, then push
git push# Switch back to develop
git checkout develop
# Delete local branch
git branch -D feature/unwanted-feature
# Delete remote branch
git push origin --delete feature/unwanted-feature# Make the fix
git add .
# Amend the last commit
git commit --amend --no-edit
# Force push (only safe on feature branches!)
git push --forceRMAgent has three layers of automated checks:
Location: .git/hooks/pre-commit
Triggers when:
- Documentation structure changes → Reminds to check CLAUDE.md
- Test modifications → Reminds to check README.md for coverage stats
- Core code changes → Reminds to check CLAUDE.md
- Dependency updates → Reminds to check README.md
What it does:
- Detects changes that might affect key documentation
- Shows which docs need review (with checkmarks for already-modified files)
- Prompts to confirm before allowing commit
- Prevents accidental outdated documentation
Example:
⚠️ DOCUMENTATION REVIEW REMINDER
• Tests modified (check if coverage stats need updating)
Please review and update if necessary:
✓ CLAUDE.md - Already modified
📄 README.md - User-facing docs, badges, quick start
📄 AGENTS.md - LangChain patterns, agent architecture
Continue with commit? (y/n)
Location: .claude/settings.local.json
PostToolUse Hook - After running pytest with coverage:
📊 Test coverage: 88%
💡 Reminder: Update coverage stats in CLAUDE.md and README.md if significantly changed
PreToolUse Hook - Before git push:
⚠️ Pushing to remote. Recent commits:
66a29ca docs: reorganize documentation structure
e3937b5 feat: add Claude Code slash commands
See docs/guides/claude-code-setup.md for full hook documentation.
Location: .github/workflows/pr-tests.yml
Every PR automatically runs:
- Linting -
ruff checkandblack --check - Tests - Full test suite with coverage
- Coverage Check - Must maintain 80%+ coverage
Required for merge due to branch protection on develop and main.
If tests fail:
- Check the Actions tab on GitHub for error details
- Fix the issues locally
- Push the fixes (CI runs again automatically)
# Run the same checks locally before pushing
uv run black .
uv run ruff check .
uv run pytest --cov=rmagent --cov-fail-under=80# Start new feature
git checkout develop && git pull && git checkout -b feature/name
# Save and push work
git add . && git commit -m "message" && git push
# Create PR to develop
gh pr create --base develop
# Merge PR and update local
gh pr merge --squash --delete-branch && git checkout develop && git pull
# Check status
git status
git log --oneline -10
git branch -a# See what changed
git diff # Uncommitted changes
git diff --staged # Staged changes
git log --oneline -10 # Recent commits
# Undo changes
git checkout -- file.py # Discard changes to file
git reset HEAD file.py # Unstage file
git reset --soft HEAD~1 # Undo last commit (keep changes)
# Branch info
git branch -a # List all branches
git branch -vv # Show tracking info
git remote -v # Show remotesgit pull origin developgit fetch origin
git rebase origin/develop
git push --force- Git will mark conflicts in files with
<<<<<<<markers - Edit files to resolve conflicts (remove markers, keep desired code)
- Stage resolved files:
git add file.py - Complete merge:
git commit(orgit rebase --continueif rebasing) - Push:
git push
# Run tests locally to debug
uv run pytest -v
# Check specific test
uv run pytest tests/unit/test_file.py::test_name -v
# Run with more output
uv run pytest -vv -s- Check git status:
git status - View recent history:
git log --oneline --graph --all -10 - See what branch you're on:
git branch - GitHub CLI help:
gh pr --help
- Keep features small - Easier to review and merge
- Commit often - Small, logical commits are better than large ones
- Write good commit messages - Future you will thank you
- Pull before push - Stay up to date with develop
- Test before PR - Don't rely on CI to catch basic issues
- One feature per branch - Don't mix unrelated changes
- Delete merged branches - Keep your branch list clean
- Trust the hooks - Pre-commit and Claude Code hooks help maintain quality
- Update docs proactively - Don't wait for the hook to remind you
- Use slash commands -
/test,/lint,/coveragefor quick checks
- git-for-newbies.md - Git collaboration fundamentals (pull vs fetch, branch relationships, sync strategies)
- developer-guide.md - Complete developer documentation
- claude-code-setup.md - Slash commands and hooks