GitLab Cheat Sheet
Projects, merge requests, pipelines, CI/CD variables, and the GitLab API — self-hosted or SaaS, these are the commands.
glab CLI & Auth
5glab auth loginAuthenticate glab (GitHub, GitLab, or custom)
glab auth statusShow auth state
glab auth logoutEnd the session
glab config set --global gitlab_uri https://gitlab.example.comPoint at a self-hosted instance
glab versionglab version
Projects & Repos
6glab repo clone OWNER/REPOClone a project
glab repo view OWNER/REPOView project details
glab repo create NAME --publicCreate a project
glab repo create --fork OWNER/REPOFork a project
glab repo list --ownerList visible projects
git push --set-upstream origin HEADPush current branch as MR source
Merge Requests
10glab mr createCreate an MR from the current branch
glab mr create --draftDraft MR
glab mr listOpen MRs in the repo
glab mr list --all --label review:neededFilter MRs by label
glab mr view MR_IDView an MR
glab mr checkout MR_IDCheck out the MR branch
glab mr diff MR_IDShow the MR diff
glab mr approve MR_IDApprove an MR
glab mr merge MR_ID --squashSquash-merge an MR
glab mr close MR_IDClose without merging
Issues
6glab issue create --title "T" --description "D"Create an issue
glab issue listList open issues
glab issue list --assignee USER --label bugFilter by assignee/label
glab issue view ISSUE_IDView an issue
glab issue close ISSUE_IDClose an issue
glab issue boardShow the issue board
CI/CD Pipelines
9glab ci viewLatest pipeline status
glab ci view PIPELINE_IDView a specific pipeline
glab ci statusShow pipeline/job status
glab ci listRecent pipelines
glab ci run --ref mainTrigger a pipeline for a ref
glab ci createRun a new pipeline
glab ci trace JOB_IDStream a job's log
glab ci retry JOB_IDRe-run a failed job
glab ci delete PIPELINE_IDDelete a pipeline
REST API
7glab api /projects?search=NAMESearch projects
glab api /projects/:id/pipelinesPipelines for a project
glab api /projects/:id/variablesList CI/CD variables
glab api -X POST /projects/:id/variables -f key=NAME -f value=VALUEAdd a CI/CD variable
glab api /projects/:id/merge_requests?state=openedOpen MRs via API
glab api /projects/:id/releasesReleases via API
glab api /versionServer version
Variables & Secrets
4glab variable listProject CI/CD variables
glab variable set NAMECreate/update a variable
glab variable set NAME --value VAL --maskedSet as masked
glab variable delete NAMEDelete a variable