π§ Contribution guidelines β
A practical guide to setting up and managing your team workflow with GitHub.
π Table of Contents β
- Setting Up GitHub
- Repository Settings
- Team Access & Key Files
- Branch Strategy
- Team Workflow
- Code Reviews & Pull Requests
- Writing Good Docs
- Managing Issues & Tasks
- Security
1. π Setting Up GitHub β
Create a New Repository β
- Navigate to GitHub
- Click "New repository"
- Provide:
- A clear name (e.g.,
project-name
) - A short description
- Set visibility: Public or Private
- A clear name (e.g.,
- Check "Add a README file"
2. βοΈ Repository Settings β
Protect Your Main Branch β
- Go to:
Settings > Branches > Add rule
- Target the
main
branch - Enable:
- β Require pull request reviews
- β Require status checks before merging
- Add additional rules as needed for production safety
3. π₯ Team Access & Key Files β
Team Access Management β
- Go to:
Settings > Collaborators and teams
- Create teams with proper roles:
- Admin: Full control
- Write: Push & merge code
- Read: View only
- Assign members to appropriate teams
Key Repository Files β
README.md
: Project overview, setup, usage, contributionLICENSE
: License information (e.g., MIT, Apache 2.0).gitignore
: Ignore Django/Python/OS-specific filesrequirements.txt
: List of Python dependencies.env.example
: Template for environment variables (never commit.env
)
4. πΏ Branch Strategy β
Main Branches β
main
: Production-ready codedevelop
: Ongoing development and integration
Supporting Branches β
feature/*
: New features (branched fromdevelop
)bugfix/*
: Fixes for reported bugs (fromdevelop
)hotfix/*
: Urgent fixes (frommain
)release/*
: Preparation for a new release (fromdevelop
)
5. π Team Workflow β
Daily Workflow β
bash
# Clone the repository
git clone https://github.com/org/project.git
# Create a new feature branch
git checkout -b feature/your-task
# Make changes and commit
git add .
git commit -m "Describe what you changed"
# Push your branch
git push -u origin feature/your-task
- Open a Pull Request (PR) to merge into
develop
Best Practices β
- Start your day by syncing with the latest code:bash
git checkout develop git pull git checkout your-feature-branch git merge develop # or: git rebase develop
- Commit frequently with meaningful messages
- Push regularly to avoid losing work
6. π Code Reviews & Pull Requests β
- Open a PR once the feature/fix is complete
- Peer review is required:
- Clean, tested, and well-documented code
- Get approval from required reviewers
- Address all review comments before merging
7. π Writing Good Docs β
Essential Documentation β
README.md
: Project overview, installation, and usageCONTRIBUTING.md
: Guidelines for contributing (recommended)- API Docs: Use tools like OpenAPI or Django REST Framework (DRF) Docs
- In-code Docs: Use meaningful docstrings and inline comments
Django-Specific Recommendations β
- Models: Document fields, choices, and indexes
- Views: Describe expected input/output and authentication
8. π Managing Issues & Tasks β
GitHub Issues β
- Use templates for:
- Bug Reports
- Feature Requests
- Documentation Suggestions
- Apply relevant labels:
bug
,enhancement
,documentation
,technical-debt
- Assign issues to responsible team members
GitHub Projects (Boards) β
- Set up a Project board with columns:
To Do
βIn Progress
βReview
βDone
- Link issues to project cards
- Use milestones to group issues by release
9. π Security β
- Use
.env
files for secrets (never commit actual credentials) - Store API tokens and keys in secure environments
- Regularly review dependencies (e.g.,
pip list --outdated
) - Enable GitHubβs built-in security tools:
Settings > Code Security and Analysis
π Additional Reading β
The Ultimate GitHub Collaboration Guide