| name | git-workflow |
| description | Expert in Git workflows, branching strategies, commit conventions, and code review practices. Use when managing branches, creating commits, resolving conflicts, or following team git conventions. |
Git Workflow Agent
Expert guidance for Git operations and workflow best practices.
Project Conventions
Branch Strategy
main - Production-ready code
develop or feature branches - Development work
- Feature branches naming:
feat/description, fix/description, chore/description
Commit Message Format
Follow conventional commits:
<type>(<scope>): <subject>
<body>
<footer>
Types:
| Type | Description |
|---|
feat | New feature |
fix | Bug fix |
docs | Documentation changes |
style | Code style (formatting, semicolons) |
refactor | Code refactoring |
test | Adding/updating tests |
chore | Maintenance tasks |
Examples:
feat(auth): add Google OAuth login
fix(practice): correct question answer display
docs(readme): update installation instructions
chore(deps): upgrade Next.js to 15.1.0
Pull Request Guidelines
PR Naming:
- Use the same format as commit messages
feat: add new feature
fix: resolve issue with X
PR Description Template:
## Summary
Brief description of changes
## Changes
- List of specific changes made
## Testing
How was this tested?
## Screenshots (if UI changes)
Before/After images
Common Operations
Starting a New Feature
git checkout -b feat/my-new-feature
git checkout main && git pull origin main
git checkout -b feat/my-new-feature
Syncing with Main
git fetch origin
git rebase origin/main
git merge origin/main
Committing Changes
git add src/app/page.tsx src/components/Button.tsx
git add .
git commit -m "feat(auth): add sign-in component"
git commit --amend -m "feat(auth): add sign-in component with validation"
Viewing History
git log --oneline -10
git show HEAD
git log --grep="fix" --oneline
git log --follow --oneline path/to/file.ts
Undoing Changes
git restore --staged path/to/file.ts
git checkout -- path/to/file.ts
git restore path/to/file.ts
git revert HEAD
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
Working with Remote
git push -u origin feat/my-feature
git push
git pull origin main
git fetch origin
Conflict Resolution
During Rebase
git rebase origin/main
git add <resolved-files>
git rebase --continue
git rebase --abort
During Merge
git merge origin/main
git add .
git commit -m "merge: resolve conflicts with main"
Conflict Markers
<<<<<<< HEAD
Your changes
=======
Incoming changes
> > > > > > > branch-name
Keep both changes, remove markers:
Combined changes here
Gitignore Best Practices
For this Next.js project, ensure these are ignored:
# Dependencies
node_modules/
# Build output
.next/
out/
build/
# Environment
.env
.env.local
.env.*.local
# IDE
.idea/
.vscode/
# OS
.DS_Store
Thumbs.db
# Logs
*.log
npm-debug.log*
# Testing
coverage/
# Misc
*.pem
Git Hooks (Husky)
This project uses Husky for pre-commit hooks. Config is in .husky/.
pnpm prepare
git commit --no-verify -m "message"
Best Practices
- Commit early, commit often - Small, focused commits
- Write meaningful messages - Explain "why", not just "what"
- Never force push to main -
git push --force-with-lease if needed
- Pull before starting work - Avoid merge conflicts
- Use branches for all changes - Never commit directly to main
- Review before pushing - Check what you're about to push