Skip to content

Git Contribution Guidelines

İrem Önen edited this page Mar 14, 2026 · 3 revisions

Welcome to our team's Git Contribution Guidelines! To keep our codebase clean, stable, and easy to collaborate on, we follow a structured Git workflow. Please read through this guide carefully before contributing.

1. Workflow Overview

We utilize a structured branching model to ensure that our production environment remains stable while active development continues.

  • main Branch: This is the production-ready branch. Code here must always be stable and deployable. Never commit directly to main.
  • develop Branch: This is our primary integration branch. All new features and bug fixes are merged here for testing before being released to main.

2. Branch Management

Creating clear, isolated branches keeps our work organized and prevents overlapping changes.

Branch Naming Conventions

Always use a descriptive name prefixed with the type of work you are doing. Use lowercase letters and separate words with hyphens:

  • feature/ - For new features or significant enhancements (e.g., feature/user-authentication).
  • bugfix/ - For resolving issues in the code (e.g., bugfix/login-crash).
  • hotfix/ - For critical, urgent fixes meant directly for production (e.g., hotfix/payment-gateway-down).
  • docs/ - For documentation updates (e.g., docs/api-endpoints).

Creating a Feature Branch

Always branch off from the latest develop branch (unless creating a hotfix).

git checkout develop
git pull origin develop
git checkout -b feature/your-feature-name

Branch Cleanup

To keep our repository clean, delete your feature branch both locally and remotely once your Pull Request has been successfully merged.

3. Committing & Pushing Code

We use Conventional Commits to generate clean, readable project history.

Commit Naming Conventions

Format your commit messages as type: description (all lowercase):

  • feat: - A new feature (e.g., feat: add Google OAuth login).
  • fix: - A bug fix (e.g., fix: resolve null pointer on profile load).
  • docs: - Documentation only changes (e.g., docs: update README setup instructions).
  • chore: - Maintenance tasks, dependency updates, etc. (e.g., chore: update npm packages).
  • refactor: - Code changes that neither fix a bug nor add a feature.

Best Practices

  • Commit often: make small, logical commits rather than one massive commit at the end of the day.
  • Write clear descriptions: If a commit is complex, add a detailed description in the commit body.

Pushing Your Code

When you are ready to share your work or back it up, push your branch to the remote repository:

git push -u origin feature/your-feature-name

4. Synchronization & Conflict Resolution

Staying up-to-date with the main codebase prevents painful merge conflicts later.

  • Pull frequently: Before starting coding or before opening a Pull Request, pull the latest changes from develop into your feature branch:
git fetch origin
git merge origin/develop
  • Handling Conflicts: If Git flags a merge conflict, open the affected files, resolve the conflicting lines manually, test your code to ensure it still works, and then commit the resolved files.

5. Pull Requests (PRs) & Code Review

All code must be reviewed and pass automated checks before it can be merged into develop.

Things to Consider Before Creating a PR

  • Did I thoroughly test my changes locally?
  • Did I remove all debugging code (e.g., console.log, temporary variables)?
  • Did I update the relevant documentation?

Merge Policy

A Pull Request cannot be merged unless it meets the following criteria:

  1. Builds Succeed: The application must compile and build without errors.
  2. Approvals: The PR must have at least one approval from a team member.

Code Review Etiquette

  • Reviewers: Look for logical errors, edge cases, and code clarity. Leave constructive, actionable feedback.
  • Authors: Treat feedback as a tool for improvement, not as a personal critique.

6. Hotfixes

Occasionally, a critical bug makes it into the main production environment and requires immediate attention.

  • Procedure: Branch directly off main using the hotfix/ prefix (e.g., hotfix/fix-database-connection).
  • Merging: Once the hotfix is approved, it must be merged into both main (to fix production) and develop (so the bug isn't reintroduced in the next release).

Clone this wiki locally