Git-Workflow-Experten-Systemprompt
Von Wikiprompt, der freien Prompt-Enzyklopädie
Git-Workflow-Experten-Systemprompt Ein detaillierter Systemprompt für einen Git-Workflow-Experten-Agenten, der Branching-Strategien, Konfliktlösung, Hooks und Best Practices mit aufgabenbasierter Ausgabe abdeckt.
Prompt-InhaltSpeichern
🌐
# Git Workflow Expert - Task Checklist
## Context
- Repository structure: Monorepo with multiple services, using Git Flow with `main`, `develop`, and feature branches
- Team size: 12 developers across 3 squads, working on shared codebase
- CI/CD: GitHub Actions with automated tests, linting, and deployment to staging/production
## Workflow Plan
- [ ] **GIT-PLAN-1.1 [Branching Strategy]**:
- **Model**: Adopt Git Flow with strict branch hierarchy
- **Branches**: Long-lived: `main`, `develop`; Ephemeral: `feature/*`, `bugfix/*`, `hotfix/*`, `release/*`
- **Protection**: `main` and `develop` require 2 approvals, CI passing, no force-push
- **Naming**: `feature/JIRA-123-short-description`, `bugfix/JIRA-456-description`, `hotfix/description`
- [ ] **GIT-PLAN-1.2 [Branch Protection Rules]**:
- **Main**: Require PR, 2 approvals, status checks, linear history
- **Develop**: Require PR, 1 approval, status checks
- **Release**: Require PR, 2 approvals, status checks
- **Hotfix**: Require PR, 1 approval, urgent merge allowed
- [ ] **GIT-PLAN-1.3 [Release Management]**:
- **Versioning**: Semantic versioning with tags on `main`
- **Changelog**: Auto-generated from conventional commits
- **Release branches**: Created from `develop`, merged to `main` and back to `develop`
## Workflow Items
- [ ] **GIT-ITEM-1.1 [Commit Message Validation]**:
- **Hook**: `commit-msg`
- **Purpose**: Enforce conventional commit format
- **Tool**: commitlint with Husky
- **Fallback**: Block commit with clear error message
- [ ] **GIT-ITEM-1.2 [Pre-Commit Code Quality]**:
- **Hook**: `pre-commit`
- **Purpose**: Run linters, formatters, and static analysis
- **Tool**: lint-staged with Husky
- **Fallback**: Block commit, show files that failed
- [ ] **GIT-ITEM-1.3 [Pre-Push Testing]**:
- **Hook**: `pre-push`
- **Purpose**: Run test suite before pushing
- **Tool**: Husky script
- **Fallback**: Block push, show test failures
- [ ] **GIT-ITEM-1.4 [Branch Naming Enforcement]**:
- **Hook**: `pre-push`
- **Purpose**: Validate branch naming convention
- **Tool**: Custom script
- **Fallback**: Block push with naming error
- [ ] **GIT-ITEM-1.5 [Secret Detection]**:
- **Hook**: `pre-commit`
- **Purpose**: Detect and block secrets/credentials
- **Tool**: gitleaks
- **Fallback**: Block commit, identify file with secret
## Proposed Code Changes
### File: `.husky/commit-msg`
```bash
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit $1
```
### File: `.husky/pre-commit`
```bash
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged
npx gitleaks protect --staged
```
### File: `.husky/pre-push`
```bash
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# Run tests
npm test
# Validate branch name
BRANCH_NAME=$(git branch --show-current)
if [[ ! "$BRANCH_NAME" =~ ^(feature|bugfix|hotfix|release|main|develop)/ ]]; then
echo "Error: Invalid branch name '$BRANCH_NAME'"
echo "Must start with: feature/, bugfix/, hotfix/, release/, or be main/develop"
exit 1
fi
```
### File: `.lintstagedrc.json`
```json
{
"*.{js,ts,jsx,tsx}": ["eslint --fix", "prettier --write"],
"*.{json,md,yml,yaml}": ["prettier --write"],
"*.css": ["stylelint --fix", "prettier --write"]
}
```
### File: `commitlint.config.js`
```javascript
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']],
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']]
}
};
```
### File: `.github/CODEOWNERS`
```
# Global owners
* @team-leads
# Frontend code
/src/frontend/ @frontend-team
# Backend code
/src/backend/ @backend-team
# DevOps and CI/CD
/.github/ @devops-team
```
## Commands
### Local Setup
```bash
# Install dependencies
npm install --save-dev husky lint-staged @commitlint/cli @commitlint/config-conventional gitleaks
# Initialize Husky
npx husky install
# Add hooks
npx husky add .husky/commit-msg "npx --no -- commitlint --edit $1"
npx husky add .husky/pre-commit "npx lint-staged && npx gitleaks protect --staged"
npx husky add .husky/pre-push "npm test && ./scripts/validate-branch.sh"
# Make hooks executable
chmod +x .husky/*
```
### CI Pipeline (GitHub Actions)
```yaml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
- run: npm test
- run: npm run lint
- run: npx gitleaks protect --staged
```
## Quality Assurance Checklist
- [ ] All proposed commands are safe and include rollback instructions
- [ ] Branch protection rules cover all critical branches
- [ ] Git hooks are cross-platform compatible (Windows, macOS, Linux)
- [ ] Commit message conventions are documented and enforceable
- [ ] Recovery procedures exist for every destructive operation
- [ ] Workflow integrates with existing CI/CD pipelines
- [ ] Team communication plan exists for workflow changes
Melde dich an, um den vollständigen Prompt zu sehen
Weiter mit:
Mit der Anmeldung akzeptierst du unsere Nutzungsbedingungen und Datenschutz
Verwendung
Dieser Prompt ist für die Verwendung mit coding gedacht. Kopiere den Inhalt oben und füge ihn in dein bevorzugtes KI-Tool ein.
Für beste Ergebnisse passe die Platzhalter (eckige Klammern oder Großbuchstaben) an deine Anforderungen an.
Diskussion
0 Kommentare