1.1.13 Ensure linear history is required

ID

cis_sscs/linear_history

Severity

high

Category

source_code/code_changes

Levels

Optional

false

Description

Linear history is the name for Git history where all commits are listed in chronological order, one after another. Such history exists if a pull request is merged either by rebase merge (re-order the commits history) or squash merge (squashes all commits to one). Ensure that linear history is required by requiring the use of rebase or squash merge when merging a pull request.

Rationale

Enforcing linear history produces a clear record of activity, and as such it offers specific advantages: it is easier to follow, easier to revert a change, and bugs can be found more easily.

Verification

For each repository in use, ensure linear history is required and/or that only squash merge and rebase merge are allowed.

Remediation

For each repository in use, require linear history and/or allow only rebase merge and squash merge.