Git Working Rules
๐ฅ Rolesโ
-
Repository Owner
- Manage repo access
- Prevent direct commits to
develop,test,uat,prod - Review merge important branches:
test,uat,prod
-
Maintainers (Lead Devs)
- Manage
release&hotfixbranches - Review & merge pull requests (PRs)
- Help define working process
- Manage
-
Developers
- Create
feature/*,bugfix/*, orhotfix/*branches fromdevelop - Submit PRs to
developwhen done. - Include detailed description in PRs.
- Review and improve PRs.
- Create
-
DevOps
- Manage deployments and system config
- Deploy code from
develop,test,uat,prod
๐ Git Flowโ
Dev is the default branch. All development starts from here.
-
developโ Active development (default branch)- All new work branches are created from here
- Only
developcan merge intotest
-
testโ Internal QA/testing- Only receives merges from
develop - Can merge into
uat
- Only receives merges from
-
uatโ Pre-release, client/user testing- Only receives merges from
test - Can merge into
prod
- Only receives merges from
-
prodโ Final, stable version- Only receives merges from
uat
- Only receives merges from
๐ชด Branching Rulesโ
-
You must use one of the following prefixes for branches:
feature/*โ For new features or enhancementsbugfix/*โ For fixing bugs found during developmenthotfix/*โ For urgent, production-critical fixes
-
All branches must be created from
develop -
Example:
feature/user-login,bugfix/payment-crash,hotfix/api-down
โ๏ธ Committingโ
- Write clear, meaningful commit messages
- Avoid unrelated changes in a single commit
๐ Mergingโ
-
All changes go through Merge Requests (MRs)
-
MRs must be code reviewed
-
Use rebase on feature branches to keep history clean
-
Use merge into
developand above to retain full collaboration history -
Merge paths must follow environment flow:
developโtestโuatโprod
-
Auto-merge only if tests pass (future feature)
-
Delete merged branches (except protected ones)
๐ท๏ธ Versioning & Clean Codeโ
- Use tags for releases
- Use
.gitignorefor non-tracked files (e.g..env) - Never commit sensitive info (keys, tokens)
- Document environment variables in
README - No absolute paths in code (e.g.
/home/user/...)
๐ก Best Practicesโ
- CI/CD: Auto-test & build on commit
- Conflict resolution: Resolve before merge
- Repo size: Keep small (limit: 5โ20MB)
- Code conventions: Follow team style guides
- Code reviews: Review before merging
- Documentation: Keep everything documented
- Backup: Regularly back up repo
- Hooks: Use Git hooks to validate code before commit
- Cleanup: Remove unused branches regularly