# Git Ops Config ## Command Workflows ```yaml Status_Workflow: 1. Check working tree: git status --porcelain 2. Current branch: git branch --show-current 3. Upstream tracking: git rev-parse --abbrev-ref @{u} 4. Stash list: git stash list 5. Recent commits: git log --oneline -5 6. Unpushed commits: git log @{u}..HEAD --oneline 7. Remote status: git remote -v && git fetch --dry-run Commit_Workflow: Pre_checks: - Working tree status - Branch protection rules - Pre-commit hooks available Staging: - Interactive: git add -p - All tracked: git add -u - Specific: git add Message: - Check conventions: conventional commits, gitmoji - Generate from changes if not provided - Include issue refs Post_commit: - Run tests if cfg'd - Update checkpoint manifest - Show commit confirmation Branch_Workflow: Create: - From current: git checkout -b - From base: git checkout -b - Set upstream: git push -u origin Switch: - Check uncommitted changes - Stash if needed - git checkout Delete: - Check if merged: git branch --merged - Local: git branch -d - Remote: git push origin --delete Protection: - Never delete: main, master, develop - Warn on: release/*, hotfix/* Sync_Workflow: Fetch: - All remotes: git fetch --all --prune - Tags: git fetch --tags Pull: - With rebase: git pull --rebase - Preserve merges: git pull --rebase=preserve - Autostash: git pull --autostash Push: - Current branch: git push - With lease: git push --force-with-lease - Tags: git push --tags Submodules: - Update: git submodule update --init --recursive - Sync: git submodule sync --recursive Merge_Workflow: Pre_merge: - Create checkpoint - Fetch target branch - Check for conflicts: git merge --no-commit --no-ff Merge_strategies: - Fast-forward: git merge --ff-only - No fast-forward: git merge --no-ff - Squash: git merge --squash Conflict_resolution: - List conflicts: git diff --name-only --diff-filter=U - Use theirs: git checkout --theirs - Use ours: git checkout --ours - Manual resolution with markers Post_merge: - Verify: git log --graph --oneline - Run tests - Update documentation ``` ## Safety Mechanisms ```yaml Checkpoints: Auto_create: - Before merge - Before rebase - Before reset --hard - Before force push Format: checkpoint/git-- Confirmations: Required_for: - Force push to remote - Delete unmerged branch - Reset --hard - Rebase published commits - Checkout with uncommitted changes Validations: Pre_commit: - No secrets or API keys - No large files (>100MB) - No merge conflict markers - Code passes linting Pre_push: - Tests pass - No WIP commits - Branch naming conventions - Protected branch rules ``` ## Conflict Resolution Patterns ```yaml Common_Conflicts: Package_files: - package-lock.json: Regenerate after merge - yarn.lock: Run yarn install - Gemfile.lock: Run bundle install Generated_files: - Build artifacts: Regenerate - Compiled assets: Recompile - Documentation: Regenerate Code_conflicts: - Imports: Combine both sets - Function signatures: Communicate with team - Feature flags: Usually keep both Resolution_Strategy: 1. Understand both changes 2. Communicate with authors 3. Test both functionalities 4. Document resolution 5. Consider refactoring ``` ## Branch Patterns ```yaml Naming_Conventions: Feature: feature/- Bugfix: bugfix/- Hotfix: hotfix/- Release: release/ Experimental: exp/ Protection_Rules: main/master: - No direct commits - Require PR reviews - Must pass CI/CD - No force push develop: - Require PR for features - Allow hotfix direct merge - Must pass tests release/*: - Only fixes allowed - Version bumps only - Tag on completion ``` ## Commit Patterns ```yaml Message_Format: Conventional: (): Gitmoji: : Simple: : Types: feat: New feature fix: Bug fix docs: Documentation style: Code style (no logic change) refactor: Code restructuring test: Test additions/changes chore: Build process/tools perf: Performance improvements ci: CI/CD changes Best_Practices: - Atomic commits (one change per commit) - Present tense, imperative mood - Reference issues/tickets - Explain why, not what - Keep subject line < 50 chars - Wrap body at 72 chars ``` ## Automation Hooks ```yaml Pre_commit: - Lint staged files - Run type checking - Format code - Check for secrets - Validate commit message Pre_push: - Run full test suite - Check code coverage - Validate branch name - Check for WIP commits Post_merge: - Install new dependencies - Run database migrations - Update documentation - Notify team members ``` --- *Git Operations: Comprehensive git workflow management*