# Git Workflow Reference for AI Agents ## Repository Information **Remote URL**: `ssh://gitea@git.shihong.me:2222/snowprint/halloween-test.git` ## Agent-Specific Git Guidelines ### For All Agents When working with code: 1. Always check current branch before making changes 2. Commit logical units of work separately 3. Write descriptive commit messages following convention 4. Never commit without testing changes first ### DevOps Engineer Agent - Critical Responsibilities As the DevOps engineer, you have special responsibilities for version control: #### Repository Health - Monitor commit history quality - Ensure branch strategy is followed - Verify no sensitive data is committed - Maintain clean, linear history when possible #### Pre-commit Validation Before any commit, verify: - [ ] No credentials or API keys - [ ] No large binary files (unless necessary) - [ ] .gitignore is properly configured - [ ] File permissions are appropriate - [ ] No debug code or console.logs left behind #### Branch Management - Enforce feature branch workflow - Ensure main branch is protected - Review merge requests for quality - Tag releases appropriately #### Security Checks - Scan for accidentally committed secrets - Verify SSH keys are properly managed - Ensure repository access is controlled - Monitor for suspicious commits ### Product Manager Agent When committing specification or documentation changes: ```bash git commit -m "docs(spec): update event requirements" git commit -m "docs(readme): clarify deployment process" ``` ### Code Reviewer Agent After reviewing code, document findings: ```bash git commit -m "docs(review): add code review notes for PR #X" ``` ### Test Engineer Agent When adding or updating tests: ```bash git commit -m "test(validation): add HTML5 validation tests" git commit -m "test(responsive): add mobile layout tests" ``` ### UX Expert Agent When making design-related changes: ```bash git commit -m "style(layout): improve mobile ASCII art display" git commit -m "feat(a11y): enhance keyboard navigation" ``` ### Minimalist Geek Webpage Builder Agent When implementing features: ```bash git commit -m "feat(page): implement Halloween event page" git commit -m "feat(ascii): add McDonald's ASCII logo" git commit -m "style(theme): apply terminal aesthetic" ``` ## Commit Message Templates ### Feature Implementation ``` feat(component): add new feature - Implement core functionality - Add responsive behavior - Ensure accessibility compliance Closes #issue-number ``` ### Bug Fix ``` fix(component): resolve specific issue - Identify root cause - Implement solution - Add regression test Fixes #issue-number ``` ### Documentation ``` docs(file): update documentation - Add missing information - Clarify existing content - Fix typos and formatting ``` ## Common Git Operations ### Starting Work ```bash git checkout main git pull origin main git checkout -b feature/descriptive-name ``` ### Committing Changes ```bash git add # Prefer specific files over git add . git commit -m "type(scope): description" ``` ### Updating Branch ```bash git fetch origin git rebase origin/main # Resolve conflicts if any git rebase --continue ``` ### Pushing Changes ```bash git push origin feature/descriptive-name ``` ## What NOT to Commit ❌ **Never commit:** - Passwords, API keys, tokens - Private SSH keys - Database credentials - Personal information - Large binary files (unless necessary) - IDE-specific files (covered by .gitignore) - Temporary or cache files - node_modules or similar dependencies ✅ **Always commit:** - Source code - Documentation - Configuration templates (without secrets) - .gitignore file - README and guides - Project specifications ## Emergency Procedures ### Accidentally Committed Sensitive Data ```bash # If not pushed yet git reset --soft HEAD~1 # Remove sensitive data git add . git commit -m "fix: remove sensitive data" # If already pushed - contact DevOps immediately # May require force push and secret rotation ``` ### Wrong Branch ```bash # Move uncommitted changes to correct branch git stash git checkout correct-branch git stash pop ``` ### Need to Undo Last Commit ```bash # Keep changes git reset --soft HEAD~1 # Discard changes (careful!) git reset --hard HEAD~1 ``` ## Quality Gates Before pushing to remote: 1. ✅ Code compiles/runs without errors 2. ✅ All tests pass 3. ✅ HTML5 validation passes 4. ✅ Responsive design verified 5. ✅ Commit message follows convention 6. ✅ No sensitive data included 7. ✅ .gitignore is up to date ## Repository Maintenance ### Regular Tasks (DevOps) - Weekly: Review commit history - Monthly: Clean up stale branches - Per release: Create version tags - Ongoing: Monitor repository size ### Release Process ```bash # Create release tag git checkout main git pull origin main git tag -a v1.0.0 -m "Release: Halloween Event Page v1.0.0" git push origin v1.0.0 ``` ## Resources - Project spec: `project-spec.md` - Contributing guide: `CONTRIBUTING.md` - Project guidance: `CLAUDE.md` - Agent constitution: `.claude/constitution.md`