Merge eligibility
Determine if your branch is ready to be merged
Last updated
Determine if your branch is ready to be merged
Last updated
Merge eligibility involves a series of checks and validations to determine whether a branch is ready to be merged. Once all conditions are satisfied, baz recommends a suitable merge strategy based on the types of branches involved.
Merge Decision Criteria
Conflicts Check:
baz first checks if there are any unresolved conflicts between the branches. If there are conflicts, the branch cannot be merged.
CI Runs Check:
Next, it verifies if there are any ongoing or failing continuous integration (CI) tests. If there are any pending CI runs, the branch cannot be merged.
Review Status Check:
Finally, it checks the review status of the branch. The branch can only be merged if it has been approved by the required reviewers.
If all these conditions are met—no conflicts, no pending CI runs, and approved review status—the branch is considered mergeable.
Recommended Merge Strategy
The function recommends a merge strategy based on the types of branches involved:
From Feature Branch to Main Branch:
If you are merging a feature branch into the main branch, the recommended strategy is to "squash" the commits. This condenses all changes from the feature branch into a single commit on the main branch.
Between Persistent Branches:
If you are merging between persistent branches (such as release, hotfix, and main branches), or from the main branch to a feature branch, the recommended strategy is to "rebase" the commits. This replays the commits from one branch onto another, keeping a clean and linear project history.
Between Feature Branches:
If you are merging between two feature branches, the recommended strategy is to perform a regular "merge," combining all commits from both branches.
The recommended strategy is checked against the list of allowed merge strategies. If the recommended strategy is permitted, it is used for the merge.