GitHub interview questions

14 questions from the GitHub Fundamentals: Collaboration, Pull Requests and Actions course, each with the correct answer and an explanation. Try to answer before you open the answer.

Module 2: Basic Collaboration

1. Which command downloads a full copy of a remote repository, including its history?

  1. git remote add origin
  2. git push
  3. git clone
  4. git fetch only
Show answer

Answer: git clone

`git clone` copies the entire repository, while `git remote add` only links an existing local repo to a URL.

Lesson: Pushing & Cloning

Module 3: Pull Requests

2. What does submitting a review as "Request changes" do?

  1. Immediately merges the PR
  2. Deletes the pull request
  3. Approves the PR
  4. Blocks merging until addressed and re-reviewed
Show answer

Answer: Blocks merging until addressed and re-reviewed

It flags the PR as needing changes and blocks merging if required reviews are enforced.

Lesson: Reviewing a Pull Request

Module 4: Issues

3. Which closing keyword in a PR description automatically closes issue #42 when the PR merges?

  1. Fixes #42
  2. See #42
  3. About #42
  4. Mentions #42
Show answer

Answer: Fixes #42

GitHub recognizes keywords like Fixes, Closes and Resolves before an issue reference and auto-closes it on merge.

Lesson: Issues for Project Tracking

Module 6: Branch Protection

4. What does Dependabot do?

  1. Opens pull requests to update vulnerable or outdated dependencies
  2. Deletes old branches
  3. Hosts your site
  4. Runs your tests only
Show answer

Answer: Opens pull requests to update vulnerable or outdated dependencies

It automates dependency updates and security fixes.

Lesson: Security: 2FA, Dependabot & Secret Scanning

Module 7: GitHub Actions

5. Where must GitHub Actions workflow YAML files live in a repository?

  1. actions/
  2. .github/workflows/
  3. ci/
  4. .git/hooks/
Show answer

Answer: .github/workflows/

GitHub only discovers workflow files inside the .github/workflows/ directory.

Lesson: A Minimal Workflow

Module 9: Team Features

6. Which organization permission level lets someone push code but not change repo settings?

  1. Read
  2. Admin
  3. Write
  4. Owner only
Show answer

Answer: Write

Write allows pushing and managing issues/PRs, while changing repo settings requires Admin.

Lesson: Organizations & Teams

7. How are Git and GitHub related?

  1. They are the same program
  2. Git runs only on GitHub
  3. GitHub hosts Git repositories and adds collaboration features
  4. GitHub replaces Git
Show answer

Answer: GitHub hosts Git repositories and adds collaboration features

Git is the version-control tool; GitHub is the hosting platform.

Lesson: Organizations & Teams

8. Which command copies a remote repository with its full history?

  1. git remote add
  2. git commit
  3. git stash
  4. git clone
Show answer

Answer: git clone

clone also sets up origin.

Lesson: Organizations & Teams

9. What is a pull request?

  1. A request to review and merge changes
  2. A download command
  3. A backup
  4. A branch deletion
Show answer

Answer: A request to review and merge changes

It proposes merging one branch into another.

Lesson: Organizations & Teams

10. Which keyword closes issue #42 on merge?

  1. See #42
  2. Fixes #42
  3. About #42
  4. Ref #42
Show answer

Answer: Fixes #42

Closing keywords auto-close linked issues.

Lesson: Organizations & Teams

11. Which merge strategy combines all branch commits into one?

  1. Merge commit
  2. Rebase
  3. Squash
  4. Cherry-pick
Show answer

Answer: Squash

Squash keeps main's history compact.

Lesson: Organizations & Teams

12. Where do GitHub Actions workflow files live?

  1. actions/
  2. ci/
  3. .git/
  4. .github/workflows/
Show answer

Answer: .github/workflows/

GitHub detects YAML files in that folder.

Lesson: Organizations & Teams

13. What do branch protection rules do?

  1. Require reviews and passing checks before merge
  2. Hide the branch
  3. Delete old commits
  4. Speed up CI
Show answer

Answer: Require reviews and passing checks before merge

They stop direct pushes and force-pushes to protected branches.

Lesson: Organizations & Teams

14. Which permission should most contributors get?

  1. Admin
  2. Write (least privilege needed)
  3. Owner
  4. None
Show answer

Answer: Write (least privilege needed)

Grant the minimum level required.

Lesson: Organizations & Teams

← Back to the course