GitHub Foundations (GH-900) · 28% practice allocation

GitHub GH-900: Understand Git and GitHub Basics Practice Questions

5 free sample questions from the Understand Git and GitHub Basics domain, with answers and explanations. The full GH-900 bank has 150 questions across 7 domains. Questions are scenario-based and written from the official GitHub exam guide.

1.

A developer has committed several files but forgot to include a small configuration file in the last commit. They have NOT yet pushed to the remote. Which Git command lets them add the forgotten file to the most recent commit WITHOUT creating a new commit?

  • A. git reset --hard HEAD~1
  • B. git cherry-pick HEAD
  • C. git commit --amend✓ Correct
  • D. git revert HEAD
Explanation

git commit --amend rewrites the most recent commit, allowing the developer to stage new changes and include them in the existing commit without creating an additional commit. git revert HEAD creates a new commit that undoes the previous commit—it does not modify the original. git reset --hard HEAD~1 removes the last commit entirely and discards all changes, which is destructive and not appropriate here. git cherry-pick HEAD applies the changes from a specific commit onto the current branch; it doesn't amend an existing commit.

2.

A team is setting up a new project and wants to save a snapshot of their codebase at a stable release point so they can always return to that exact state. Which Git concept is MOST appropriate for this purpose?

  • A. Branch
  • B. Stash
  • C. Tag✓ Correct
  • D. Fork
Explanation

A tag is a named reference that points to a specific commit, making it ideal for marking stable release points (e.g., v1.0.0). Unlike branches, tags do not move as new commits are added. A branch is a movable pointer used for ongoing development, not for pinning a specific release snapshot. A fork is a copy of an entire repository on GitHub, not a Git concept for marking points in history. A stash temporarily shelves uncommitted changes and is not used for marking releases.

3.

Your organization stores infrastructure-as-code in a GitHub repository. The security team wants GitHub to automatically detect dependency vulnerabilities and open pull requests with version updates. Which GitHub feature should be enabled?

  • A. Code scanning
  • B. Secret scanning
  • C. GitHub Actions
  • D. Dependabot✓ Correct
Explanation

Dependabot monitors a repository's dependency files and automatically opens pull requests to update dependencies when vulnerabilities are detected, directly addressing the requirement. Secret scanning detects hardcoded secrets and credentials in code—not dependency vulnerabilities. Code scanning uses static analysis (e.g., CodeQL) to find bugs and security vulnerabilities in source code logic, not dependency versions. GitHub Actions is a CI/CD automation platform; while it could be configured to perform dependency checks, it does not natively open PRs for vulnerable dependencies.

4.

A security engineer notices that a developer accidentally committed an AWS access key to a public GitHub repository 10 minutes ago. GitHub automatically sent an alert. Which GitHub security feature detected this issue?

  • A. GitHub Advisory Database
  • B. Secret scanning✓ Correct
  • C. Dependabot alerts
  • D. Code scanning with CodeQL
Explanation

Secret scanning automatically detects known secret patterns (such as AWS access keys, API tokens, and private keys) in repository content and alerts repository owners and, in some cases, the service provider. Dependabot alerts detect vulnerable dependencies in package manifests, not hardcoded secrets. Code scanning with CodeQL analyzes source code for logic bugs and security vulnerabilities through static analysis — it does not specifically scan for credential patterns. The GitHub Advisory Database is a curated database of known security vulnerabilities in open-source packages, not a scanning tool.

5.

A mobile developer is waiting for a code review and wants to stay productive while away from their laptop. Which of the following actions can they perform using the GitHub Mobile app? (Select TWO.)

  • A. Run and monitor GitHub Actions workflows triggered by a push event.
  • B. Configure branch protection rules for a repository.
  • C. Review and comment on open pull requests.✓ Correct
  • D. Create and edit files directly in a repository using a full web-based editor.
  • E. Manage notifications and triage issues by applying labels.✓ Correct
Explanation

GitHub Mobile supports reviewing pull requests (viewing diffs, leaving comments, approving or requesting changes) and managing notifications and issues (including applying labels, assigning, and closing issues). These are core triage and review tasks GitHub Mobile is built for. Option A is wrong: while you can view workflow run statuses in GitHub Mobile, you cannot configure or trigger workflows — that requires the web UI or CLI. Option D is wrong: the full web-based editor (github.dev / Codespaces) is a browser feature, not part of the GitHub Mobile app; Mobile has limited inline editing at best. Option B is wrong: configuring branch protection rules is an administrative action only available through the web UI or API, not GitHub Mobile.

Test yourself across every GH-900 domain

The free GH-900 practice test mixes about 20 questions weighted like the exam. The full 150-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

Understand Git and GitHub Basics study guide (GH-900) →

Other GH-900 domains

← All GitHub Foundations study resources