Practice vocabulary for the GitHub CLI (gh) including creating PRs, reviewing, managing issues, triggering workflows, and using gh api for advanced access.
0 / 26 completed
1 / 26
Which gh CLI command creates a new pull request from the current branch?
'gh pr create' opens an interactive prompt (or accepts flags) to create a pull request from the current branch to the base branch, without needing to visit the GitHub web UI.
2 / 26
To submit a review (approve, request changes, or comment) on a pull request using the CLI, you would use _____.
'gh pr review' allows you to approve, request changes, or leave a comment review on a pull request directly from the terminal.
3 / 26
To create a new GitHub issue from the terminal, the correct command is _____.
'gh issue create' opens an interactive prompt to create a new issue, accepting a title, body, labels, and assignees as flags or interactive inputs.
4 / 26
To manually trigger a GitHub Actions workflow from the command line, you would use _____.
'gh workflow run' triggers a workflow_dispatch event for a specified workflow file, useful for manually starting deployments or batch jobs without pushing a commit.
5 / 26
When the built-in gh CLI commands are not sufficient, developers use _____ to make arbitrary calls to the GitHub REST or GraphQL API.
'gh api' lets you make authenticated HTTP requests to any GitHub REST or GraphQL API endpoint, using the stored credentials from 'gh auth login' — useful for automation beyond what built-in commands support.
6 / 26
Sarah just submitted a pull request for the new user authentication module. During the code review, her team lead, Mark, comments on Slack: 'Can you please use gh api repoinfo -r / to fetch the branch's latest commit SHA and update your PR description with the full URL?'. What does Mark likely mean when he asks Sarah to use this command?
Mark is asking Sarah to use the gh api repoinfo command to retrieve specific details about her branch. The output of this command contains crucial information – the commit SHA – that's necessary to build the precise URL for the pull request. This URL is essential for tracking and referencing the PR within GitHub, ensuring accurate updates and communication. While gh api allows interaction with the API, using it for a specific task like getting branch details demonstrates an understanding of how to leverage the CLI for targeted operations.
7 / 26
David: 'Hey team, I'm working on a PR to update the billing service. I've used gh api repoinfo -r /my-repo/billing-service to get the latest commit SHA, but it's not automatically updating my PR description with the full URL. Is there a way to force this?'
What does gh api repoinfo -r /my-repo/billing-service accomplish in David's scenario?
The command gh api repoinfo -r /my-repo/billing-service utilizes the GitHub CLI's ability to interact with the API. Specifically, it calls the `repos/get` endpoint to retrieve information about a repository and its branches, in this case, focusing on getting the latest commit SHA. This is crucial because David needs that SHA to accurately update his PR description with the correct URL for tracking changes.
8 / 26
Mark in the Slack message is asking Sarah to use `gh api repoinfo -r /` to retrieve specific information about the branch she's working on. Specifically, he wants her to get the latest commit SHA and include a full URL for the PR description. Why does Mark need this detailed information instead of relying solely on the GitHub CLI's built-in pull request functionality?
The correct answer is that Mark needs this detailed information to manually construct the full URL for the pull request description. While the GitHub CLI can handle creating pull requests, it doesn't automatically populate the description with the commit SHA and URL in a way that's consistently formatted or easily traceable. This approach provides greater control over the PR details, facilitating a more precise review process and accurate tracking of changes – something automated tools often lack.
9 / 26
Mark's request for Sarah to use `gh api repoinfo -r /my-repo/billing-service` stems from a need for greater control and precision when updating the pull request description. While the standard GitHub CLI provides some automated features, it doesn't always guarantee the exact URL format or inclusion of specific commit details required for comprehensive PR documentation. Using `gh api repoinfo -r` allows Sarah to directly query the GitHub API for the branch's latest commit SHA and construct a fully qualified URL, ensuring accuracy and preventing potential issues with automatic formatting.
The correct answer (2) accurately reflects Mark's intent. The `gh api repoinfo -r` command is used for granular control over API requests. While it *does* fetch the commit SHA, the key benefit is that Sarah can then use this information to build a custom URL for her PR description – something the standard GitHub CLI doesn't natively handle with the desired level of precision.
10 / 26
Sarah just submitted a pull request for the new user authentication module. During the code review, her team lead, Mark, comments on Slack: 'Can you please use gh api repoinfo -r / to fetch the branch's latest commit SHA and update your PR description with the full URL?'. What does Mark likely mean when he asks Sarah to use this command?
Mark is asking Sarah to use the gh api repoinfo command to retrieve specific details about her branch. The output of this command contains crucial information – the commit SHA – that's necessary to build the precise URL for the pull request. This URL is essential for tracking and referencing the PR within GitHub, ensuring accurate updates and communication. While gh api allows interaction with the API, using it for a specific task like getting branch details demonstrates an understanding of how to leverage the CLI for targeted operations.
11 / 26
David: 'Hey team, I'm working on a PR to update the billing service. I've used gh api repoinfo -r /my-repo/billing-service to get the latest commit SHA, but it's not automatically updating my PR description with the full URL. Is there a way to force this?'
What does gh api repoinfo -r /my-repo/billing-service accomplish in David's scenario?
The command gh api repoinfo -r /my-repo/billing-service utilizes the GitHub CLI's ability to interact with the API. Specifically, it calls the `repos/get` endpoint to retrieve information about a repository and its branches, in this case, focusing on getting the latest commit SHA. This is crucial because David needs that SHA to accurately update his PR description with the correct URL for tracking changes.
12 / 26
Mark in the Slack message is asking Sarah to use `gh api repoinfo -r /` to retrieve specific information about the branch she's working on. Specifically, he wants her to get the latest commit SHA and include a full URL for the PR description. Why does Mark need this detailed information instead of relying solely on the GitHub CLI's built-in pull request functionality?
The correct answer is that Mark needs this detailed information to manually construct the full URL for the pull request description. While the GitHub CLI can handle creating pull requests, it doesn't automatically populate the description with the commit SHA and URL in a way that's consistently formatted or easily traceable. This approach provides greater control over the PR details, facilitating a more precise review process and accurate tracking of changes – something automated tools often lack.
13 / 26
Mark's request for Sarah to use `gh api repoinfo -r /my-repo/billing-service` stems from a need for greater control and precision when updating the pull request description. While the standard GitHub CLI provides some automated features, it doesn't always guarantee the exact URL format or inclusion of specific commit details required for comprehensive PR documentation. Using `gh api repoinfo -r` allows Sarah to directly query the GitHub API for the branch's latest commit SHA and construct a fully qualified URL, ensuring accuracy and preventing potential issues with automatic formatting.
The correct answer (2) accurately reflects Mark's intent. The `gh api repoinfo -r` command is used for granular control over API requests. While it *does* fetch the commit SHA, the key benefit is that Sarah can then use this information to build a custom URL for her PR description – something the standard GitHub CLI doesn't natively handle with the desired level of precision.
14 / 26
Sarah just submitted a pull request for the new user authentication module. During the code review, her team lead, Mark, comments on Slack: 'Can you please use gh api repoinfo -r / to fetch the branch's latest commit SHA and update your PR description with the full URL?'. What does Mark likely mean when he asks Sarah to use this command?
Mark is asking Sarah to use the gh api repoinfo command to retrieve specific details about her branch. The output of this command contains crucial information – the commit SHA – that's necessary to build the precise URL for the pull request. This URL is essential for tracking and referencing the PR within GitHub, ensuring accurate updates and communication. While gh api allows interaction with the API, using it for a specific task like getting branch details demonstrates an understanding of how to leverage the CLI for targeted operations.
15 / 26
David: 'Hey team, I'm working on a PR to update the billing service. I've used gh api repoinfo -r /my-repo/billing-service to get the latest commit SHA, but it's not automatically updating my PR description with the full URL. Is there a way to force this?'
What does gh api repoinfo -r /my-repo/billing-service accomplish in David's scenario?
The command gh api repoinfo -r /my-repo/billing-service utilizes the GitHub CLI's ability to interact with the API. Specifically, it calls the `repos/get` endpoint to retrieve information about a repository and its branches, in this case, focusing on getting the latest commit SHA. This is crucial because David needs that SHA to accurately update his PR description with the correct URL for tracking changes.
16 / 26
Mark in the Slack message is asking Sarah to use `gh api repoinfo -r /` to retrieve specific information about the branch she's working on. Specifically, he wants her to get the latest commit SHA and include a full URL for the PR description. Why does Mark need this detailed information instead of relying solely on the GitHub CLI's built-in pull request functionality?
The correct answer is that Mark needs this detailed information to manually construct the full URL for the pull request description. While the GitHub CLI can handle creating pull requests, it doesn't automatically populate the description with the commit SHA and URL in a way that's consistently formatted or easily traceable. This approach provides greater control over the PR details, facilitating a more precise review process and accurate tracking of changes – something automated tools often lack.
17 / 26
Mark's request for Sarah to use `gh api repoinfo -r /my-repo/billing-service` stems from a need for greater control and precision when updating the pull request description. While the standard GitHub CLI provides some automated features, it doesn't always guarantee the exact URL format or inclusion of specific commit details required for comprehensive PR documentation. Using `gh api repoinfo -r` allows Sarah to directly query the GitHub API for the branch's latest commit SHA and construct a fully qualified URL, ensuring accuracy and preventing potential issues with automatic formatting.
The correct answer (2) accurately reflects Mark's intent. The `gh api repoinfo -r` command is used for granular control over API requests. While it *does* fetch the commit SHA, the key benefit is that Sarah can then use this information to build a custom URL for her PR description – something the standard GitHub CLI doesn't natively handle with the desired level of precision.
18 / 26
Sarah just submitted a pull request for the new user authentication module. During the code review, her team lead, Mark, comments on Slack: 'Can you please use gh api repoinfo -r / to fetch the branch's latest commit SHA and update your PR description with the full URL?'. What does Mark likely mean when he asks Sarah to use this command?
Mark is asking Sarah to use the gh api repoinfo command to retrieve specific details about her branch. The output of this command contains crucial information – the commit SHA – that's necessary to build the precise URL for the pull request. This URL is essential for tracking and referencing the PR within GitHub, ensuring accurate updates and communication. While gh api allows interaction with the API, using it for a specific task like getting branch details demonstrates an understanding of how to leverage the CLI for targeted operations.
19 / 26
David: 'Hey team, I'm working on a PR to update the billing service. I've used gh api repoinfo -r /my-repo/billing-service to get the latest commit SHA, but it's not automatically updating my PR description with the full URL. Is there a way to force this?'
What does gh api repoinfo -r /my-repo/billing-service accomplish in David's scenario?
The command gh api repoinfo -r /my-repo/billing-service utilizes the GitHub CLI's ability to interact with the API. Specifically, it calls the `repos/get` endpoint to retrieve information about a repository and its branches, in this case, focusing on getting the latest commit SHA. This is crucial because David needs that SHA to accurately update his PR description with the correct URL for tracking changes.
20 / 26
Mark in the Slack message is asking Sarah to use `gh api repoinfo -r /` to retrieve specific information about the branch she's working on. Specifically, he wants her to get the latest commit SHA and include a full URL for the PR description. Why does Mark need this detailed information instead of relying solely on the GitHub CLI's built-in pull request functionality?
The correct answer is that Mark needs this detailed information to manually construct the full URL for the pull request description. While the GitHub CLI can handle creating pull requests, it doesn't automatically populate the description with the commit SHA and URL in a way that's consistently formatted or easily traceable. This approach provides greater control over the PR details, facilitating a more precise review process and accurate tracking of changes – something automated tools often lack.
21 / 26
Mark's request for Sarah to use `gh api repoinfo -r /my-repo/billing-service` stems from a need for greater control and precision when updating the pull request description. While the standard GitHub CLI provides some automated features, it doesn't always guarantee the exact URL format or inclusion of specific commit details required for comprehensive PR documentation. Using `gh api repoinfo -r` allows Sarah to directly query the GitHub API for the branch's latest commit SHA and construct a fully qualified URL, ensuring accuracy and preventing potential issues with automatic formatting.
The correct answer (2) accurately reflects Mark's intent. The `gh api repoinfo -r` command is used for granular control over API requests. While it *does* fetch the commit SHA, the key benefit is that Sarah can then use this information to build a custom URL for her PR description – something the standard GitHub CLI doesn't natively handle with the desired level of precision.
22 / 26
During a standup meeting, Alex mentions he's using `gh api repoinfo -r /my-repo/feature/new-ui` to get the latest commit SHA for his pull request. His teammate, Ben, asks, 'Why not just use `gh repo show --json sha`?'. What is the primary reason behind Alex's choice?
Alex is leveraging the granular control offered by `gh api repoinfo`. This command specifically targets a repository and branch using its path, enabling precise data extraction—crucial when updating PR descriptions or automating tasks. `gh repo show` provides a broader overview and doesn't inherently support this level of branch-specific targeting; it's primarily designed for displaying general repository details.
23 / 26
Maria is reviewing a pull request and receives a comment from David on Slack: 'Can you use `gh api repoinfo -r /` to get the latest commit SHA for this branch? It's more reliable than just pulling the SHA directly from the UI.' What does David likely mean by 'more reliable'?
David's comment highlights the potential for discrepancies between the visual representation of a branch in the GitHub UI and its underlying state. Directly copying the SHA from the UI could return an outdated value if the branch has been updated since the last time the UI was refreshed. `gh api repoinfo -r /` ensures retrieval directly from the repository, reducing this risk.
24 / 26
During a code review discussion, Emily uses the following command in her terminal: `gh api repoinfo -r /my-repo/main`. What is the primary purpose of this command?
The command `gh api repoinfo -r /my-repo/main` is specifically designed to fetch information about the branch named 'main' within the repository '/my-repo'. This includes retrieving the latest commit SHA – a vital piece of data for code reviews and PR updates. It's not used for merging, creating, deleting, or modifying branches directly.
25 / 26
You need to update the description of a pull request with the SHA of its latest commit. Which command is MOST appropriate for this task?
The command `gh pr edit --body 'Pull request SHA: '` is the most direct and efficient method for modifying a pull request's description. It allows you to include the SHA of the latest commit in the body, fulfilling the requirement. While other commands might be useful in different scenarios (e.g., updating the title), this one directly addresses the problem of adding the SHA to the PR's description.
26 / 26
Liam is preparing a standup and needs to quickly show the SHA of the branch he's currently working on. He uses `gh repo show --json sha`. What information does this command primarily provide?
The command `gh repo show --json sha` is specifically designed to extract and display the SHA (Secure Hash Algorithm) of the *latest* commit on the currently checked-out branch. It's a quick way to verify the commit hash without needing to manually find it in the repository interface.
Practice vocabulary for the GitHub CLI (gh) including creating PRs, reviewing, managing issues, triggering workflows, and using gh api for advanced access.
How many exercises are in this module?
This module has 26 multiple-choice exercises, each with instant feedback and a full explanation of the correct answer.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to use with no account, sign-up, or paywall.
Do I need to create an account to do these exercises?
No account is required. Just click an option to answer — your score for this session is tracked automatically in the progress bar above.
What happens if I choose the wrong answer?
You'll immediately see which answer was correct, plus a full explanation covering the vocabulary and reasoning behind it — mistakes are where most of the learning happens.
Can I retry the exercises if I want a higher score?
Yes — use the "Try again" button on the results screen to reset and go through all the questions again.
Is my progress saved if I close the page?
No. Progress is tracked only for your current visit; reloading or leaving the page resets the counter. This keeps the exercise simple and account-free.
Where can I find more GitHub Platform Language exercises?
Browse the full GitHub Platform Language hub for related drills, or check the "Next up" link below to continue with a connected topic.
How is this different from reading an article on the same topic?
Articles explain vocabulary and concepts in prose; this exercise tests and reinforces that vocabulary through active recall with immediate feedback — the two work best together.
Who writes these exercises?
Every exercise is written by the CoderSlingo team, drawing on real workplace English used in IT roles, then reviewed for accuracy and clarity.