Skip to main content

Pull Requests

GitHub Pull Requests are used to merge completed branches into their target branch.

Most regular development branches target:

develop

Pull requests should be created only after the branch is ready for remote validation.

Push a branch

Push the current branch and configure its upstream:

git push -u origin <branch>

Repository pre-push hooks run before the branch reaches the remote.

The pre-push workflow validates areas such as formatting, linting, type safety, tests, builds, and branch policy.

Create a pull request

GitHub CLI can create a pull request directly from the terminal:

gh pr create \
--base develop \
--head <branch> \
--title "<title>" \
--body "<description>"

The pull request title should follow the same concise semantic style used by repository commits.

Review the pull request:

gh pr view <branch>

Wait for remote checks

Use GitHub CLI to wait for the pull request checks:

gh pr checks <branch> \
--watch \
--interval 10 \
--fail-fast

After the watch completes, the final state can be inspected with:

gh pr checks <branch>

A successful merge requires the repository's required remote quality gate to pass.

Conditionally disabled CI jobs may appear as skipped. A skipped conditional job is not itself a failure when the repository CI configuration intentionally does not require that tier for the current change.

The stable aggregate result is:

CI Gate

Check merge readiness

Before merging, inspect the pull request state:

gh pr view <branch> \
--json number,title,state,mergeable,reviewDecision,statusCheckRollup

The pull request should remain open, be mergeable, and have all required quality checks satisfied before the merge command is executed.

Merge

The repository uses merge commits for regular pull requests so the branch boundary remains visible in Git history.

Merge the pull request and remove the completed branch:

gh pr merge <branch> \
--merge \
--delete-branch

Do not use --squash or --rebase when the repository workflow requires merge commits.

The --delete-branch option normally removes the merged feature branch after the pull request is completed.

Verify the merge

Confirm the final pull request state:

gh pr view <branch> \
--json number,title,state,mergedAt,url

The expected state is:

MERGED

After merging

Return to the integration branch and synchronize it with the remote:

git switch develop
git pull --ff-only origin develop
git fetch origin --prune

Verify the final repository state:

git branch -vv
git status --short

The working tree should be clean before starting the next branch.

Manual branch cleanup

Manual cleanup is normally unnecessary when:

gh pr merge <branch> \
--merge \
--delete-branch

successfully removes the completed branch.

If cleanup is still required, delete the local merged branch with:

git branch -d <branch>

Delete the remote branch with:

git push origin --delete <branch>

Then prune stale remote-tracking references:

git fetch origin --prune