一键导入
version-control
Effective Git workflows including commit conventions, branching strategies, pull request best practices, and merge conflict resolution.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Effective Git workflows including commit conventions, branching strategies, pull request best practices, and merge conflict resolution.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | version-control |
| description | Effective Git workflows including commit conventions, branching strategies, pull request best practices, and merge conflict resolution. |
Purpose: Effective use of Git for collaboration and code management.
# Format
type(scope): Brief description (50 chars max)
Detailed explanation (wrap at 72 characters)
Types:
- feat: New feature
- fix: Bug fix
- docs: Documentation
- style: Formatting
- refactor: Code restructuring
- test: Adding tests
- chore: Maintenance
- perf: Performance improvement
- ci: CI/CD changes
- build: Build system changes
# Examples
feat(auth): Add password reset functionality
Implements password reset via email with time-limited tokens.
Tokens expire after 1 hour.
Fixes #234
---
fix(api): Correct null reference in UserService
Added null check before accessing user properties in
GetUserProfileAsync method.
Resolves #456
# Feature branch
git checkout main
git pull origin main
git checkout -b feature/user-auth
# Make changes
git add .
git commit -m "feat(auth): Add login endpoint"
# Push and create PR
git push origin feature/user-auth
# After PR review, rebase if needed
git fetch origin
git rebase origin/main
# Squash commits before merging (optional)
git rebase -i HEAD~3
# Force push after rebase
git push origin feature/user-auth --force-with-lease
# Main branches
- main/master: Production-ready code
- develop: Integration branch
# Supporting branches
- feature/*: New features
- bugfix/*: Bug fixes
- hotfix/*: Emergency production fixes
- release/*: Release preparation
# Example workflow
git checkout develop
git pull origin develop
git checkout -b feature/add-payment
# ... make changes ...
git push origin feature/add-payment
# Create PR to develop
# Release
git checkout -b release/v1.2.0 develop
# ... version bump, final testing ...
git checkout main
git merge release/v1.2.0
git tag -a v1.2.0 -m "Release version 1.2.0"
git push origin main --tags
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa]rm/
[Aa]rm64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio
.vs/
*.suo
*.user
*.userosscache
*.sln.docstates
*.userprefs
# ReSharper
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# NuGet
*.nupkg
*.snupkg
**/packages/*
!**/packages/build/
project.lock.json
project.fragment.lock.json
artifacts/
# Test results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.trx
*.coverage
*.coveragexml
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# .NET Core
appsettings.Development.json
appsettings.Local.json
*.user.json
# User secrets
secrets.json
# Environment files
.env
.env.local
.env.*.local
# IDEs
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
Desktop.ini
# Azure
*.pubxml
*.azurePubxml
publish/
# Database
*.mdf
*.ldf
*.ndf
# Local History
.localhistory/
# Rider
.idea/
*.sln.iml
Create .git/hooks/pre-commit:
#!/bin/sh
# Format C# files before commit
echo "Running dotnet format..."
dotnet format --verify-no-changes
if [ $? -ne 0 ]; then
echo "Code formatting issues detected. Run 'dotnet format' to fix."
exit 1
fi
echo "Running tests..."
dotnet test --no-build --verbosity quiet
if [ $? -ne 0 ]; then
echo "Tests failed. Commit aborted."
exit 1
fi
exit 0
Create .git/hooks/commit-msg:
#!/bin/sh
# Validate commit message format
commit_msg_file=$1
commit_msg=$(cat "$commit_msg_file")
# Check if commit message matches conventional commits format
pattern="^(feat|fix|docs|style|refactor|test|chore|perf|ci|build)(\(.+\))?: .{1,50}"
if ! echo "$commit_msg" | grep -qE "$pattern"; then
echo "ERROR: Commit message does not follow conventional commits format"
echo "Expected: type(scope): description"
echo "Example: feat(auth): Add login endpoint"
exit 1
fi
exit 0
# User configuration
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Editor
git config --global core.editor "code --wait"
# Line endings (Windows)
git config --global core.autocrlf true
# Aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.visual '!gitk'
# Diff tool
git config --global diff.tool vscode
git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'
# Merge tool
git config --global merge.tool vscode
git config --global mergetool.vscode.cmd 'code --wait $MERGED'
# Format: MAJOR.MINOR.PATCH
# MAJOR: Breaking changes
# MINOR: New features (backward compatible)
# PATCH: Bug fixes
# Create annotated tag
git tag -a v1.2.3 -m "Release version 1.2.3"
# Push tags
git push origin v1.2.3
# Or push all tags
git push origin --tags
# List tags
git tag -l
# View tag details
git show v1.2.3
# Delete tag
git tag -d v1.2.3
git push origin :refs/tags/v1.2.3
# Checkout specific version
git checkout tags/v1.2.3 -b version-1.2.3
Related Skills:
Build production-ready AI agents with Microsoft Foundry and Agent Framework. Covers agent architecture, model selection, orchestration, tracing, and evaluation.
Design robust REST APIs with proper versioning, pagination, error handling, rate limiting, and OpenAPI documentation.
Structure projects for maintainability and scalability with clean architecture, separation of concerns, and consistent project layouts.
Systematic code review and audit practices including automated checks, security audits, compliance verification, and review checklists.
Manage application configuration with environment variables, Azure Key Vault, feature flags, and environment-specific settings.
Fundamental coding principles for production development including SOLID, DRY, KISS, and common design patterns with C# examples.