| applyTo | **/* |
|---|---|
| description | Git workflow conventions including branching, commits, and pull requests |
Guidelines for consistent Git usage across repositories.
Use descriptive, lowercase branch names with hyphens:
<type>/<short-description>
Types:
feature/- New functionalityfix/- Bug fixesdocs/- Documentation onlyrefactor/- Code restructuringtest/- Adding or updating testschore/- Maintenance tasks
Examples:
feature/user-authentication
fix/login-validation-error
docs/api-documentation
refactor/database-queries
test/payment-integration
chore/update-dependencies
Avoid:
- Spaces or special characters
- Overly long names
- Generic names like
fix,update,changes
Follow Conventional Commits format:
<type>: <description>
[optional body]
[optional footer]
Types:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Formatting (no code change)refactor:- Code restructuringtest:- Adding/updating testschore:- Maintenance tasks
Guidelines:
- Use imperative mood ("Add feature" not "Added feature")
- Keep first line under 72 characters
- Capitalize first letter after type
- No period at end of subject line
- Separate subject from body with blank line
Good examples:
feat: Add user authentication flow
fix: Resolve null reference in payment processing
docs: Update API endpoint documentation
refactor: Extract validation logic to separate module
Avoid:
Fixed stuff
WIP
updates
asdfasdf
- Ensure your branch is up to date with the base branch
- Run tests locally and verify they pass
- Review your own changes first
- Remove debugging code and console logs
Use the same format as commit messages:
feat: Add user authentication flow
Include:
- Summary - What changed and why (1-3 bullet points)
- Test plan - How to verify the changes work
- Breaking changes - Note any breaking changes
Template:
## Summary
- Added user login and logout functionality
- Integrated with OAuth2 provider
- Added session management
## Test Plan
- [ ] Login with valid credentials succeeds
- [ ] Login with invalid credentials shows error
- [ ] Logout clears session
## Breaking Changes
None- Keep PRs focused and small when possible
- Large changes should be split into logical commits
- If a PR is too large, consider breaking it into smaller PRs
- Use
mainas the default branch name for new repositories mainis the industry standard and preferred for inclusive terminology- When working with existing repositories using
master, follow the repository's convention - Consider migrating legacy repositories from
mastertomainwhen practical
mainis the production-ready branch- Should always be in a deployable state
- Direct commits to main should be avoided
- Create feature branch from
main - Make changes in small, logical commits
- Push branch and create PR
- After review and approval, merge to
main - Delete feature branch after merge
# Update your feature branch with latest main
git fetch origin
git rebase origin/mainPrefer rebase for feature branches to maintain clean history.
- Combines all commits into one clean commit
- Keeps main branch history clean
- Use when feature branch has many small/WIP commits
- Preserves full commit history
- Use for significant features where history is valuable
- Use for release branches
- Applies commits linearly without merge commit
- Use when commits are already clean and logical
- Never force push to
mainor shared branches - Only force push to your own feature branches
- Always communicate with team before force pushing shared branches
- Pull before pushing to avoid conflicts
- Don't commit sensitive data (secrets, credentials, API keys)
- Use
.gitignorefor build artifacts and dependencies - Review staged changes before committing
# View branch status
git status
# View commit history
git log --oneline -10
# Amend last commit (before pushing)
git commit --amend
# Stash changes temporarily
git stash
git stash pop
# Undo last commit (keep changes)
git reset --soft HEAD~1
# View changes before committing
git diff --staged