Git Cheat Sheet · Integrate

Open a pull request

gh pr create · glab mr create

A pull request (GitHub) or merge request (GitLab) offers a branch's commits for review before integrating them. Push your branch first, then open the request from the forge, with the gh or glab CLI, or from Merathon.

What it does

Proposes the commits of a branch for review on GitHub (pull request) or GitLab (merge request).

A use case

Your branch is pushed and you want it reviewed before integrating it.

On the command line

git push -u origin <branch>
Publishes the branch to propose.
gh pr create
GitHub CLI: creates the pull request, asking for a title and a description.
gh pr create --draft --base main
Draft pull request, targeting main.
glab mr create
GitLab CLI: creates the merge request.
gh pr checkout <number>
Gets a pull request's branch locally to test it.

In Merathon

  1. Push the branch.
  2. Right-click the branch → "Create a GitHub pull request…" or "Create a GitLab merge request…" (an account on the forge must be connected).

Frequently asked questions

What is the difference between a pull request and a merge request?

Essentially none: GitHub says pull request, GitLab says merge request.

How do I update a pull request?

Push new commits to the same branch: the pull request updates by itself.

See also