Git Configuration
> **Skill Purpose:** Repository setup, version control patterns, and workflow management
SKILL.md
Full skill instructions
Git Configuration
Skill Purpose: Repository setup, version control patterns, and workflow management
Core Skill Pattern
Objective: Establish consistent version control practices, repository structure, and team collaboration workflows.
Universal Pattern:
- Define repository structure and ignore patterns
- Set up branch strategy and naming conventions
- Configure commit message standards
- Establish merge and review workflows
- Create repository maintenance procedures
Key Decisions (Project-Specific):
- Branching strategy (GitFlow, GitHub Flow, etc.)
- Commit message format and standards
- Code review requirements and workflows
- Repository access and permissions
- Integration with CI/CD and project management
Project-Specific Implementation Notes
Customize per project:
- Branching strategy based on team size and release cadence
- Commit standards based on integration requirements
- Review processes based on team experience
- Repository structure based on project complexity
- Integration with existing development tools
Example Implementation (Standard Git Workflow Pattern)
Note: This is an example pattern. Adapt branching strategy and workflows based on your specific team and project requirements.
Prerequisites (Example)
- Project initialized
- Team collaboration patterns defined
- Development workflow established
Example: Standard Git Repository Setup Implementation
Framework-Specific Example: This demonstrates the pattern using standard Git workflows. Adapt for your branching strategy and team requirements.
1. Initialize Git Repository
# Initialize Git repository
git init
# Set default branch name to main
git branch -M main
# Configure user information (if not already configured)
git config user.name "Your Name"
git config user.email "[email protected]"
# Configure default behavior
git config init.defaultBranch main
git config pull.rebase false
git config push.autoSetupRemote true
2. Create .gitignore
Create .gitignore:
# Dependencies
node_modules/
.pnp
.pnp.js
# Production builds
.next/
out/
build/
dist/
# Environment variables
.env.local
.env.development.local
.env.test.local
.env.production.local
# Testing
coverage/
.nyc_output/
junit.xml
# Next.js
.next/
.vercel
# Static generated files
.cache/
# Temporary files
*.tmp
*.temp
*.swp
*.swo
*~
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Editor directories and files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace
.project
.settings/
.classpath
.factorypath
.spring
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
pnpm-debug.log*
.pnpm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Coverage directory used by tools like istanbul
coverage/
*.lcov
# nyc test coverage
.nyc_output
# Dependency directories
node_modules/
jspm_packages/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build output
.nuxt
# Vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Storybook build outputs
.out
.storybook-out
# Temporary folders
tmp/
temp/
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build output
.nuxt
# Gatsby files
.cache/
public
# Storybook build outputs
.out
.storybook-out
# Temporary folders
tmp/
temp/
# Logs
logs
*.log
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Local Netlify folder
.netlify
# SvelteKit build / generate output
.svelte-kit/
# Vite
.vite/
# End of https://www.gitignore.io/api/node
3. Create .gitattributes
Create .gitattributes:
# Auto detect text files and perform LF normalization
* text=auto eol=lf
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.js text eol=lf
*.jsx text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.json text eol=lf
*.md text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.txt text eol=lf
*.html text eol=lf
*.css text eol=lf
*.scss text eol=lf
*.less text eol=lf
*.svg text eol=lf
*.xml text eol=lf
*.sh text eol=lf
*.zsh text eol=lf
*.bash text eol=lf
*.fish text eol=lf
*.py text eol=lf
*.rb text eol=lf
*.php text eol=lf
*.java text eol=lf
*.go text eol=lf
*.rs text eol=lf
*.c text eol=lf
*.cpp text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.cs text eol=lf
*.vb text eol=lf
*.swift text eol=lf
*.kt text eol=lf
*.scala text eol=lf
*.clj text eol=lf
*.hs text eol=lf
*.elm text eol=lf
*.dart text eol=lf
*.lua text eol=lf
*.sql text eol=lf
*.graphql text eol=lf
*.gql text eol=lf
*.dockerfile text eol=lf
*.dockerignore text eol=lf
*.gitignore text eol=lf
*.gitattributes text eol=lf
*.editorconfig text eol=lf
*.npmignore text eol=lf
*.yarnignore text eol=lf
*.prettierrc text eol=lf
*.prettierignore text eol=lf
*.eslintrc text eol=lf
*.eslintrc.json text eol=lf
*.babelrc text eol=lf
*.babelrc.json text eol=lf
*.tsconfig.json text eol=lf
*.jsconfig.json text eol=lf
*.package.json text eol=lf
*.package-lock.json text eol=lf
*.yarn.lock text eol=lf
*.pnpm-lock.yaml text eol=lf
# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.cmd text eol=crlf
*.exe text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.svg binary
*.webp binary
*.pdf binary
*.zip binary
*.tar binary
*.tar.gz binary
*.rar binary
*.7z binary
*.gz binary
*.bz2 binary
*.xz binary
*.dll binary
*.exe binary
*.so binary
*.dylib binary
*.class binary
*.jar binary
*.war binary
*.ear binary
*.db binary
*.sqlite binary
*.sqlite3 binary
# Large files - use Git LFS if needed
*.psd binary
*.ai binary
*.sketch binary
*.fig binary
*.mp4 binary
*.mov binary
*.avi binary
*.mp3 binary
*.wav binary
*.flac binary
# Generated files
*.d.ts binary
*.min.js binary
*.min.css binary
*.map binary
*.chunk.js binary
*.chunk.css binary
# Lock files (should be treated as text but with specific handling)
*.lock text eol=lf
package-lock.json text eol=lf
yarn.lock text eol=lf
pnpm-lock.yaml text eol=lf
# Configuration files
.env* text eol=lf
*.config.js text eol=lf
*.config.ts text eol=lf
*.config.json text eol=lf
# Documentation files
*.md text eol=lf
*.txt text eol=lf
*.rst text eol=lf
*.adoc text eol=lf
*.1 text eol=lf
*.2 text eol=lf
*.3 text eol=lf
*.4 text eol=lf
*.5 text eol=lf
*.6 text eol=lf
*.7 text eol=lf
*.8 text eol=lf
*.9 text eol=lf
# Linguist language detection
.github/linguist/*.yml linguist-language=yaml
.github/linguist/*.json linguist-language=json
4. Create .git/info/attributes for Repository-Specific Settings
Create scripts/setup-git-attributes.sh:
#!/bin/bash
# Setup Git attributes for Zeus framework
echo "Setting up Git attributes for Zeus framework..."
# Create .git/info directory if it doesn't exist
mkdir -p .git/info
# Create repository-specific attributes
cat > .git/info/attributes << 'EOF'
# Zeus framework specific attributes
# Ensure all source files use LF line endings
*.js text eol=lf
*.jsx text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.json text eol=lf
*.md text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
# Binary files
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.svg binary
*.webp binary
# Generated files
*.d.ts binary
*.min.js binary
*.min.css binary
*.map binary
# Lock files
package-lock.json text eol=lf
yarn.lock text eol=lf
pnpm-lock.yaml text eol=lf
EOF
echo "Git attributes configured successfully!"
5. Configure Branch Protection Rules
Create scripts/setup-branch-protection.sh:
#!/bin/bash
# Setup branch protection rules (requires GitHub CLI)
echo "Setting up branch protection rules..."
# Check if GitHub CLI is available
if command -v gh &> /dev/null; then
# Protect main branch
gh api repos/:owner/:repo/branches/main/protection \
--method PUT \
--field required_status_checks='{"strict":true,"contexts":["ci","quality-gates"]}' \
--field enforce_admins=true \
--field required_pull_request_reviews='{"required_approving_review_count":1}' \
--field restrictions=null
echo "Branch protection rules configured!"
else
echo "GitHub CLI not found. Please configure branch protection manually."
fi
6. Create Git Hooks
Create scripts/setup-git-hooks.sh:
#!/bin/bash
# Setup Git hooks for Zeus framework
echo "Setting up Git hooks..."
# Create hooks directory
mkdir -p .git/hooks
# Pre-commit hook
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/sh
# Zeus framework pre-commit hook
echo "Running pre-commit checks..."
# Run lint-staged
npm run lint-staged
# Check for console.log statements
if git diff --cached --name-only | xargs grep -l "console\.log" 2>/dev/null; then
echo "❌ Found console.log statements in staged files. Please remove them."
exit 1
fi
# Check for TODO comments
if git diff --cached --name-only | xargs grep -l "TODO\|FIXME\|HACK" 2>/dev/null; then
echo "⚠️ Found TODO/FIXME/HACK comments. Please review before committing."
fi
echo "✅ Pre-commit checks passed!"
EOF
# Pre-push hook
cat > .git/hooks/pre-push << 'EOF'
#!/bin/sh
# Zeus framework pre-push hook
echo "Running pre-push checks..."
# Run quality gates
npm run quality-gates
echo "✅ Pre-push checks passed!"
EOF
# Commit message hook
cat > .git/hooks/commit-msg << 'EOF'
#!/bin/sh
# Zeus framework commit message hook
commit_regex='^(feat|fix|docs|style|refactor|test|chore|perf|breaking|ci|build|revert)(\(.+\))?: .{1,50}'
if ! grep -qE "$commit_regex" "$1"; then
echo "❌ Invalid commit message format!"
echo ""
echo "Commit message must follow the Conventional Commits format:"
echo " type(scope): description"
echo ""
echo "Types: feat, fix, docs, style, refactor, test, chore, perf, breaking, ci, build, revert"
echo "Example: feat(auth): add user authentication"
echo ""
echo "Please rewrite your commit message and try again."
exit 1
fi
echo "✅ Commit message format is valid!"
EOF
# Make hooks executable
chmod +x .git/hooks/pre-commit
chmod +x .git/hooks/pre-push
chmod +x .git/hooks/commit-msg
echo "Git hooks configured successfully!"
7. Create Repository Structure Script
Create scripts/setup-repo-structure.sh:
#!/bin/bash
# Setup repository structure for Zeus framework
echo "Setting up repository structure..."
# Create necessary directories
mkdir -p {src,scripts,docs,.github/workflows,.github/ISSUE_TEMPLATE,.github/PULL_REQUEST_TEMPLATE}
# Create GitHub templates
cat > .github/ISSUE_TEMPLATE/bug_report.md << 'EOF'
---
name: Bug Report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
EOF
cat > .github/ISSUE_TEMPLATE/feature_request.md << 'EOF'
---
name: Feature Request
about: Suggest an idea for this project
title: '[FEATURE] '
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
EOF
cat > .github/PULL_REQUEST_TEMPLATE.md << 'EOF'
## Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
- [ ] Test A
- [ ] Test B
## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
EOF
echo "Repository structure created successfully!"
8. Create Git Workflow Scripts
Create scripts/git-workflows.sh:
#!/bin/bash
# Git workflow scripts for Zeus framework
# Function to create feature branch
create_feature_branch() {
local branch_name=$1
if [ -z "$branch_name" ]; then
echo "Usage: $0 create-feature <branch-name>"
return 1
fi
echo "Creating feature branch: feature/$branch_name"
git checkout -b "feature/$branch_name" main
}
# Function to sync with main branch
sync_with_main() {
echo "Syncing with main branch..."
git checkout main
git pull origin main
git checkout -
git merge main
}
# Function to prepare for PR
prepare_pr() {
echo "Preparing for pull request..."
# Update main
git checkout main
git pull origin main
# Go back to feature branch
git checkout -
# Merge latest main
git merge main
# Run tests
npm run test
npm run lint
npm run build
echo "Ready for pull request!"
}
# Function to clean up merged branches
cleanup_branches() {
echo "Cleaning up merged branches..."
# Get current branch
current_branch=$(git branch --show-current)
# Switch to main
git checkout main
# Delete merged feature branches
git branch --merged | grep -v main | grep -v "\*" | xargs -n 1 git branch -d
# Go back to original branch
git checkout "$current_branch"
echo "Branch cleanup complete!"
}
# Main script logic
case "$1" in
"create-feature")
create_feature_branch "$2"
;;
"sync")
sync_with_main
;;
"prepare-pr")
prepare_pr
;;
"cleanup")
cleanup_branches
;;
*)
echo "Usage: $0 {create-feature|sync|prepare-pr|cleanup} [args]"
echo " create-feature <name> - Create new feature branch"
echo " sync - Sync current branch with main"
echo " prepare-pr - Prepare branch for pull request"
echo " cleanup - Clean up merged branches"
exit 1
;;
esac
EOF
chmod +x scripts/git-workflows.sh
9. Update Package.json with Git Scripts
Update package.json scripts:
{
"scripts": {
"git:setup": "bash scripts/setup-repo-structure.sh && bash scripts/setup-git-attributes.sh && bash scripts/setup-git-hooks.sh",
"git:feature": "bash scripts/git-workflows.sh create-feature",
"git:sync": "bash scripts/git-workflows.sh sync",
"git:prepare-pr": "bash scripts/git-workflows.sh prepare-pr",
"git:cleanup": "bash scripts/git-workflows.sh cleanup",
"git:status": "git status --porcelain",
"git:log": "git log --oneline -10",
"git:diff": "git diff --name-only"
}
}
10. Create Git Configuration Script
Create scripts/configure-git.sh:
#!/bin/bash
# Complete Git configuration for Zeus framework
echo "🚀 Configuring Git for Zeus framework..."
# Initialize repository if not already done
if [ ! -d .git ]; then
echo "Initializing Git repository..."
git init
git branch -M main
fi
# Set global Git configuration
echo "Setting global Git configuration..."
git config --global init.defaultBranch main
git config --global pull.rebase false
git config --global push.autoSetupRemote true
# Set local repository configuration
echo "Setting local Git configuration..."
git config user.name "Zeus Framework Bot"
git config user.email "[email protected]"
# Run setup scripts
echo "Running repository setup..."
npm run git:setup
# Create initial commit if repository is empty
if [ -z "$(git log --oneline 2>/dev/null)" ]; then
echo "Creating initial commit..."
git add .
git commit -m "feat: initialize Zeus framework project"
echo "🎉 Repository initialized successfully!"
echo ""
echo "Next steps:"
echo "1. Create a remote repository on GitHub"
echo "2. Add remote: git remote add origin <repository-url>"
echo "3. Push to remote: git push -u origin main"
else
echo "✅ Git configuration complete!"
fi
echo ""
echo "📋 Available Git commands:"
echo " npm run git:feature <name> - Create feature branch"
echo " npm run git:sync - Sync with main"
echo " npm run git:prepare-pr - Prepare for PR"
echo " npm run git:cleanup - Clean up branches"
echo " npm run git:status - Show repository status"
echo " npm run git:log - Show recent commits"
echo " npm run git:diff - Show changed files"
EOF
chmod +x scripts/configure-git.sh
Code Examples
Git Workflow Commands
# Initialize repository
npm run git:setup
# Create feature branch
npm run git:feature user-authentication
# Work on feature branch
git add .
git commit -m "feat(auth): add user authentication"
# Sync with main
npm run git:sync
# Prepare for pull request
npm run git:prepare-pr
# Create pull request (GitHub CLI)
gh pr create --title "feat(auth): add user authentication" --body "Implements user authentication with JWT tokens"
# Clean up after merge
npm run git:cleanup
Commit Message Examples
# Feature addition
git commit -m "feat(auth): add user authentication with JWT"
# Bug fix
git commit -m "fix(api): resolve null reference error in user service"
# Documentation
git commit -m "docs: update API documentation with new endpoints"
# Refactoring
git commit -m "refactor(components): extract common button logic into shared hook"
# Breaking change
git commit -m "breaking(api): change user response format to include metadata"
Branch Strategy
# Main branch (production)
main
# Feature branches
feature/user-authentication
feature/payment-integration
feature/dashboard-redesign
# Release branches
release/v1.0.0
release/v1.1.0
# Hotfix branches
hotfix/critical-security-patch
hotfix/production-bug-fix
Configuration Templates
Complete .gitignore for Zeus Framework
# Dependencies
node_modules/
.pnp
.pnp.js
# Production builds
.next/
out/
build/
dist/
# Environment variables
.env.local
.env.development.local
.env.test.local
.env.production.local
# Testing
coverage/
.nyc_output/
junit.xml
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Editor directories and files
.vscode/
.idea/
*.sublime-project
*.sublime-workspace
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Yarn files
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Next.js
.next/
.vercel
# Static generated files
.cache/
# Temporary files
*.tmp
*.temp
*.swp
*.swo
*~
Best Practices
- Use consistent line endings - LF for all source files
- Configure proper ignore patterns - Don't commit build artifacts
- Use branch protection - Protect main branch
- Implement Git hooks - Automated quality checks
- Follow commit message standards - Conventional Commits
- Use feature branches - Isolated development
- Regular cleanup - Remove merged branches
- Document workflows - Team collaboration
Stop Conditions
STOP and report if:
- Git initialization fails
- Hook scripts don't execute
- Branch protection setup fails
- Repository structure creation fails
Expected Outcomes:
- Git repository initialized
- Proper ignore files configured
- Line endings normalized
- Hooks functioning correctly
- Branch protection active
Verification Checklist
- Git repository initialized
- .gitignore configured correctly
- .gitattributes configured
- Git hooks installed and executable
- Branch protection rules active
- Repository structure created
- Workflow scripts functional
- Commit message validation works
- Line endings normalized
- No sensitive files tracked
Version: 1.0.0 Last Updated: 2026-01-31 Skill Category: Architecture - Scaffolding
