-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Description
π οΈ Git Best Practices and Guidelines
Effective use of Git ensures clean, organized repositories and simplifies collaboration. Follow these guidelines to maintain high-quality version control.
1. πΏ Branching Strategy
- Always create a new branch for your changes. Avoid working directly on the
mainormasterbranch. - Use descriptive names for branches:
- Feature:
feature/add-login - Bugfix:
bugfix/fix-signup-error - Hotfix:
hotfix/critical-issue
- Feature:
2. π Commit Messages
- Write clear, concise commit messages.
- Follow the format:
<type>: <short summary>
<optional detailed description>
Examples:
feat: add user authentication modulefix: resolve crash on form submissiondocs: update contribution guidelines
Types:
feat: New featuresfix: Bug fixesdocs: Documentation updatesstyle: Code style changes (formatting, missing semicolons, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
3. π§Ή Atomic Commits
- Each commit should focus on a single purpose.
- Avoid combining unrelated changes in one commit.
4. π Keep Your Branch Up-to-Date
- Regularly sync your branch with the upstream
mainbranch to avoid conflicts.
git fetch upstream
git merge upstream/main5. β Code Review Ready
- Before pushing your changes:
- Run tests to ensure nothing is broken.
- Check your code for typos and unnecessary changes.
6. π Push Regularly
- Push your commits frequently, but only when the branch is in a functional state.
git push origin branch-name7. π΅οΈ Review Before Pushing
- Check your changes before committing:
git diff8. π Collaborate with Pull Requests (PRs)
- Always open a PR for merging changes.
- Ensure PRs are small, focused, and well-documented.
- Use draft PRs for ongoing work to gather feedback.
9. π Resolve Conflicts Carefully
- When conflicts arise, resolve them carefully and test your code before committing the resolution.
Following these guidelines ensures a smooth, collaborative Git workflow and keeps the project maintainable! π If you need help, feel free to ask.
Metadata
Metadata
Assignees
Labels
No labels