Sobes.tech
Junior

How do changes in the code get into the main development branch?

sobes.tech AI

Answer from AI

Changes are merged into the main branch (usually main or master) through a process that includes:

  1. Creating a separate branch: The developer creates a new branch from the main for their task.
  2. Making changes: Changes are made and committed in this branch.
  3. Creating a Pull Request (or Merge Request): The developer creates a request to merge their branch with the main in a version control system (e.g., GitHub, GitLab, Bitbucket).
  4. Code Review: Colleagues or team leads review the Pull Request, provide comments, and suggest improvements.
  5. Automated checks: Tests (unit, integration, E2E), linters, and other checks are run to identify errors and non-compliance with standards.
  6. Approving the Pull Request: After successful code review and automated checks, the Pull Request is approved.
  7. Merge: The approved Pull Request is merged into the main branch.

Depending on the repository settings, different merge strategies may be used:

  • Merge Commit: A new merge commit is created.
  • Squash and Merge: All commits in the branch are squashed into a single new commit in the main branch.
  • Rebase and Merge (or Fast-forward): Commits from the branch are added directly after the last commit of the main branch, if there are no conflicts.

After merging, the changes become part of the main branch and are ready for further deployment or integration.