GitHub Workflow Guide for Collaborations
This guide outlines the branching and collaboration workflow for our GitHub repository. It defines how we work on features, review code, and ensure a stable and deployable main branch.
- The
mainbranch is our stable, production-ready branch. - Only thoroughly tested and reviewed code should be merged into
main. - Protected from direct commits; all changes must come through Pull Requests (PRs).
- The
devbranch is our integration branch for active development. - All feature branches are merged into
devafter review and approval. - Periodically, when
devis stable, it is merged intomain.
- Feature branches are created off of
devto work on specific features or bug fixes. - Naming convention:
feature/<feature-name>(e.g.,feature/login-page). - Once completed, feature branches are merged back into
devvia a PR.
- Clone the repository:
git clone <repository-url>
- Fetch all branches and set up tracking:
git fetch origin
- Set the upstream branches:
git checkout main git branch --set-upstream-to=origin/main main git checkout dev git branch --set-upstream-to=origin/dev dev
- Check out the
devbranch:git checkout dev
- Pull the latest changes:
git pull origin dev
- Create a new feature branch:
git checkout -b feature/<feature-name>
- Commit changes to the feature branch:
git add . git commit -m "Description of the changes"
- Push the branch to the remote repository:
git push origin feature/<feature-name>
- Once the feature is complete, go to the repository on GitHub.
- Create a Pull Request (PR) from your
feature/<feature-name>branch intodev. - Follow these guidelines when creating a PR:
- Title: Briefly describe the feature or fix.
- Description: Include:
- What was done.
- Any dependencies or setup required.
- Relevant issue numbers (if applicable).
- Request at least one reviewer to review the PR.
- Reviewers check the PR for:
- Code quality.
- Adherence to project conventions.
- Completeness and correctness.
- Address any requested changes.
- Once approved, the PR can be merged into
dev.
- When the
devbranch is stable and all features are tested:- Check out the
mainbranch:git checkout main
- Merge
devintomain:git merge dev
- Push the updated
mainbranch to the remote repository:git push origin main
- Check out the
To ensure stability and quality, the following rules are applied:
- Main Branch (
main):- Require PR reviews before merging.
- Restrict direct pushes.
- Require passing status checks (e.g., tests) before merging.
- Development Branch (
dev):- Allow PRs from feature branches only.
- Commit Often: Commit your changes frequently with meaningful messages.
- Pull Regularly: Keep your feature branch up-to-date with the latest
devbranch.git pull origin dev
- Write Clear PR Descriptions: Help reviewers understand your changes.
- Test Locally: Test your code locally before submitting a PR.
- Resolve Conflicts: If merge conflicts occur, resolve them in your feature branch before creating a PR.
- Work on a feature branch created from
dev. - Submit a PR to merge your feature branch into
dev. - Review and test changes in
dev. - Merge
devintomainwhen ready for deployment.
This workflow ensures clear collaboration, stable releases, and a structured development process.
If you have any questions or suggestions, feel free to raise them in our team discussions!