Free practice · No sign-up required

GitHub Foundations free practice test

15 questions with answer explanations. Choose an answer below to begin.

Question 1 of 15

What is the primary purpose of a version control system in software development?

Show hint

Understand core version control concepts

0/15 answered · Bookmark questions to review later. Focus the practice area to use keys 1–9 and Enter.

Learn by doing

Put your answers into practice

Use official documentation and hands-on labs to work through topics you missed.

Explore all study resources →

All questions and explanations

Prefer to read at your own pace? Work through each question below, then open its answer to check your reasoning. You can link directly to a question or print this reference.

  1. What is the primary purpose of a version control system in software development?

    1. To track changes and manage different versions of source code

    2. To automatically deploy code to production environments

    3. To compile source code into executable programs

    4. To design user interfaces for applications

    Show answer and explanation

    Correct answer

    • To track changes and manage different versions of source code

    Version control systems record modifications to files over time, enabling collaboration and history tracking. They allow teams to revert to previous states and manage concurrent changes effectively.

  2. Which action is performed when you stage changes in Git?

    1. Prepare changes to be included in the next commit

    2. Permanently delete files from the repository

    3. Publish changes to a remote server immediately

    4. Create a new branch in the repository

    Show answer and explanation

    Correct answer

    • Prepare changes to be included in the next commit

    Staging selects specific changes to be included in the next snapshot of the repository. It acts as a buffer between the working directory and the commit history.

  3. What does a pull request typically enable in a collaborative workflow?

    1. Propose and discuss changes before merging them into a target branch

    2. Automatically merge all changes without review

    3. Delete the source branch after every commit

    4. Encrypt code before it is stored in the repository

    Show answer and explanation

    Correct answer

    • Propose and discuss changes before merging them into a target branch

    Pull requests facilitate code review and discussion by proposing changes from one branch to another. They help maintain code quality and team collaboration before integration.

  4. Which of the following is a benefit of using branches in Git?

    1. Isolate work on features or fixes without affecting the main codebase

    2. Increase the size of the repository unnecessarily

    3. Prevent any form of collaboration among team members

    4. Eliminate the need for committing changes

    Show answer and explanation

    Correct answer

    • Isolate work on features or fixes without affecting the main codebase

    Branches allow developers to work on separate lines of development concurrently. This isolation supports experimentation and feature development without disrupting stable code.

  5. What is the purpose of a .gitignore file in a repository?

    1. Specify files and patterns that Git should ignore and not track

    2. Store encrypted credentials for deployment

    3. Automatically generate documentation for the project

    4. Define the project's build and test procedures

    Show answer and explanation

    Correct answer

    • Specify files and patterns that Git should ignore and not track

    The .gitignore file lists files and patterns that Git should exclude from version control. This prevents temporary or sensitive files from being committed to the repository.

  6. Which statement best describes a commit in Git?

    1. A snapshot of the repository at a point in time with a descriptive message

    2. A request to merge changes from one branch to another

    3. A remote storage location for backup purposes

    4. A tool to review code quality and style

    Show answer and explanation

    Correct answer

    • A snapshot of the repository at a point in time with a descriptive message

    Commits capture the state of tracked files at a specific moment. Each commit is uniquely identified and can be referenced later for comparison or restoration.

  7. What is the primary function of a remote repository in Git?

    1. To serve as a shared central location for collaboration and backup

    2. To execute code tests automatically on every change

    3. To generate graphical representations of commit history

    4. To store only deleted files and logs

    Show answer and explanation

    Correct answer

    • To serve as a shared central location for collaboration and backup

    Remote repositories enable multiple developers to share and synchronize their work. They act as a central hub for pushing and pulling changes across different locations.

  8. Which action updates your local repository with changes from a remote repository?

    1. Pull

    2. Push

    3. Commit

    4. Branch

    Show answer and explanation

    Correct answer

    • Pull

    The pull operation fetches changes from a remote repository and merges them into your current local branch. It helps keep your local copy up to date with others' work.

  9. What is a common use case for tags in Git?

    1. Mark specific points in history as releases or milestones

    2. Automatically delete old branches

    3. Encrypt sensitive configuration files

    4. Rewrite commit messages for clarity

    Show answer and explanation

    Correct answer

    • Mark specific points in history as releases or milestones

    Tags are often used to mark release points or significant milestones in a project's history. They provide a stable reference to specific commits.

  10. Question 10

    Link to question

    Which of the following helps resolve conflicts when merging branches?

    1. Manually reviewing and editing conflicting sections of code

    2. Deleting one of the conflicting branches

    3. Ignoring all changes from the source branch

    4. Pushing changes without any review

    Show answer and explanation

    Correct answer

    • Manually reviewing and editing conflicting sections of code

    Merge conflicts occur when changes overlap. Resolving them involves examining the differences and editing the content to integrate changes correctly.

  11. Question 11

    Link to question

    What does the term 'fork' commonly refer to in GitHub?

    1. Creating a personal copy of a repository to experiment or contribute independently

    2. Deleting a repository permanently

    3. Merging all branches into the main branch

    4. Restricting access to a repository

    Show answer and explanation

    Correct answer

    • Creating a personal copy of a repository to experiment or contribute independently

    Forking creates a separate copy of a repository under your account. It allows you to make changes without affecting the original project and later propose contributions.

  12. Question 12

    Link to question

    Which practice supports maintaining a clean and understandable commit history?

    1. Making small, focused commits with clear messages

    2. Committing large batches of unrelated changes frequently

    3. Skipping commit messages to save time

    4. Using the same commit message for every change

    Show answer and explanation

    Correct answer

    • Making small, focused commits with clear messages

    Clear commit messages and focused changes make history easier to follow and help collaborators understand the purpose of each modification. This practice improves project maintainability.

  13. Question 13

    Link to question

    What is the primary role of issues in a GitHub repository?

    1. Track tasks, bugs, and feature requests with discussions and assignments

    2. Store large binary files securely

    3. Automatically run tests on code changes

    4. Generate documentation from code comments

    Show answer and explanation

    Correct answer

    • Store large binary files securely

    Issues provide a structured way to report bugs, request features, and organize tasks. They often include comments, labels, and assignments to facilitate team collaboration.

  14. Question 14

    Link to question

    Which feature in GitHub helps you manage code review feedback efficiently?

    1. Pull request reviews and comments

    2. Automatic code compilation

    3. Repository forking restrictions

    4. Commit history encryption

    Show answer and explanation

    Correct answer

    • Pull request reviews and comments

    Pull request reviews allow collaborators to comment on specific lines, suggest changes, and approve modifications. This structured feedback helps improve code quality before merging.

  15. Question 15

    Link to question

    What is a repository's README file typically used for?

    1. Provide an overview of the project, setup instructions, and usage examples

    2. Store compiled binaries and dependencies

    3. Automatically run scripts on repository events

    4. Track detailed commit history and blame information

    Show answer and explanation

    Correct answer

    • Provide an overview of the project, setup instructions, and usage examples

    The README serves as the main documentation point for a repository. It helps users understand the project's purpose and how to get started with it.

Read all flashcards

Recall the answer before opening each card.

What is the primary purpose of a version control system?

To track changes and manage different versions of source code over time, enabling collaboration and history tracking.

What does 'staging' do in Git?

It prepares specific changes to be included in the next commit, acting as a buffer between the working directory and commit history.

What is the main function of a pull request?

To propose and discuss changes before merging them into a target branch, facilitating code review and collaboration.

Why use branches in Git?

To isolate work on features or fixes without affecting the main codebase, enabling concurrent development and experimentation.

What does a .gitignore file do?

Specifies files and patterns that Git should ignore and not track, preventing temporary or sensitive files from being committed.

What is a commit in Git?

A snapshot of the repository at a point in time with a descriptive message, uniquely identified for later reference.

What is the role of a remote repository?

To serve as a shared central location for collaboration and backup, enabling multiple developers to synchronize work.

Which command updates your local repo with remote changes?

Pull, which fetches changes from a remote repository and merges them into your current local branch.

What are tags commonly used for in Git?

To mark specific points in history as releases or milestones, providing stable references to commits.

How do you resolve a merge conflict?

By manually reviewing and editing conflicting sections of code, then staging the resolved file and committing.

What does forking a repository mean?

Creating a personal copy of a repository to experiment or contribute independently without affecting the original.

What practice improves commit history readability?

Making small, focused commits with clear, descriptive messages that explain the purpose of each change.

What is the primary role of GitHub Issues?

To provide a structured way to report bugs, request features, and organize tasks with comments, labels, and assignments.

How does code review feedback work in GitHub?

Through pull request reviews and comments, where collaborators can comment on specific lines and suggest changes.

What is a README file used for?

To provide an overview of the project, setup instructions, and usage examples for users and contributors.

What is the staging area also known as?

The index, where changes are collected before committing.

What does 'git push' do?

Uploads your local commits to a remote repository, updating the remote branch with your changes.

What is the difference between 'git fetch' and 'git pull'?

Fetch downloads objects and refs but does not merge; pull also merges fetched changes into the current branch.

What pattern should you add to .gitignore for log files?

*.log to ignore all files with the .log extension.

What information should a good commit message include?

A short subject line (imperative mood) summarizing the change, optionally a detailed body, and references to issues.

Active recall deck

Practice GitHub Foundations with real flashcards

Read the prompt, commit to an answer, then flip the card. Move through the deck at your own pace and repeat any topic that does not come back quickly.

20 free cards

Card 1 of 20

1 reviewed this session

Connect the concepts

Your GitHub Foundations study mind map

Open a branch to connect a topic with its practice questions and explanations. Use the map to choose your next review topic.

GitHub Foundations15 questions in this practice set
Understand core version control concepts(1)
Understand the Git staging workflow(1)
Understand code review and integration practices(1)
Understand branching strategies and benefits(1)
Manage repository contents effectively(1)
Understand commit fundamentals(1)
Understand remote repository roles(1)
Understand synchronization operations(1)
Understand tagging practices(1)
Handle merge conflicts appropriately(1)
Understand repository forking concepts(1)
Promote good commit hygiene(1)
More practice connections(3)
Exam-focused analysis

What this GitHub Foundations practice set measures

This is an analysis of the practice bank, not a claim about the vendor's live exam blueprint. Use it to identify the knowledge, judgment, and recall patterns exercised here, then verify your coverage against the current official exam guide.

Version Control Core Concepts

This section focuses on foundational version control concepts including tracking changes, staging, branching, and committing. Understanding these core operations is crucial for managing code history and collaborating effectively. The practice set emphasizes the purpose of version control as a system for recording modifications and enabling concurrent work. It clarifies the staging workflow as a buffer between working directory and commit history, and explains how branches isolate work without affecting the main codebase. Commits are snapshots with descriptive messages that capture the state of tracked files at specific points.

  • Version control systems track changes and manage different versions of source code.
  • Staging prepares specific changes to be included in the next commit.
  • Branches isolate work on features or fixes without affecting the main codebase.
  • Commits capture a snapshot of the repository at a point in time with a descriptive message.

Remote Collaboration and Pull Requests

This section addresses how teams collaborate using remote repositories, pull requests, forking, and code review. Remote repositories serve as shared central locations for collaboration and backup. Pull requests propose and discuss changes before merging, enabling code review and team discussion. Forking creates a personal copy of a repository for independent experimentation or contribution. Pull request reviews and comments allow efficient management of code review feedback. These workflows are essential for maintaining code quality and coordinating contributions.

  • Remote repositories enable sharing and synchronizing work among multiple developers.
  • Pull requests propose changes from one branch to another and facilitate discussion and review.
  • Forking creates a personal copy of a repository to experiment or contribute independently.
  • Pull request reviews and comments help manage code review feedback efficiently.

Repository Organization and Documentation

This section covers tools for organizing and documenting repositories efficiently. .gitignore files specify files that Git should ignore, preventing tracking of temporary or sensitive items. Tags mark specific commits as releases or milestones. Issues provide a structured way to report bugs, request features, and organize tasks. README files offer an overview of the project including setup instructions and usage examples. These practices help maintain a clean, understandable, and accessible repository.

  • .gitignore specifies files and patterns that Git should ignore and not track.
  • Tags mark specific points in history as releases or milestones.
  • Issues provide a structured way to report bugs, request features, and organize tasks.
  • README files provide an overview of the project, setup instructions, and usage examples.

Best Practices and Conflict Management

This section emphasizes good practices for commit hygiene and handling merge conflicts. Making small, focused commits with clear messages maintains a clean and understandable commit history. Merge conflicts occur when changes overlap during branch merging; they require manual review and editing of conflicting sections to integrate changes correctly. Resolving conflicts is a critical skill for collaborative development. These practices help maintain project maintainability and reduce integration issues.

  • Small, focused commits with clear messages improve commit history readability.
  • Merge conflicts require manually reviewing and editing conflicting sections of code.
  • Clear commit hygiene supports project maintainability.
  • Conflict resolution is essential for integrating parallel work.

Study workflow

Turn one GitHub Foundations attempt into a study plan

  1. 1

    Stage Changes for a Commit

    After modifying files in your working directory, use 'git add <file>' to stage specific changes. Staging allows you to select which modifications to include in the next snapshot. Review staged changes with 'git status' to ensure accuracy before committing.

  2. 2

    Create a Pull Request

    Push your feature branch to the remote repository. On GitHub, navigate to your repository and click 'New pull request'. Select the base branch (e.g., main) and the compare branch (your feature). Provide a descriptive title and comment explaining the changes, then submit for review.

  3. 3

    Resolve a Merge Conflict

    When Git indicates a conflict, open the conflicting file(s). Look for conflict markers (<<<<<<<, =======, >>>>>>>). Edit the code to integrate changes appropriately, removing conflict markers. After resolving, stage the file with 'git add' and complete the merge with 'git commit'.

  4. 4

    Use .gitignore Effectively

    Create a .gitignore file in your repository root. List file patterns for temporary files, build artifacts, and sensitive data (e.g., '*.log', 'node_modules/', '.env'). Ensure the patterns match your project's structure. Commit the .gitignore file to share ignore rules with your team.

  5. 5

    Write Good Commit Messages

    A commit message should contain a short subject line (<=50 chars) summarizing the change, followed by a blank line and a detailed body if needed. Use imperative mood (e.g., 'Fix login bug'). Reference issue numbers when applicable. Keep commits focused on one logical change.

FAQ

Questions about this exam practice page

Clear boundaries on what the bank covers, how to use it, and where official vendor information still matters.

What is the difference between Git and GitHub?+

Git is a distributed version control system for tracking changes locally. GitHub is a cloud-based hosting service that adds collaboration features like pull requests, issues, and remote repositories. You can use Git without GitHub, but GitHub enhances team workflows.

When should I use a pull request vs direct commit?+

Direct commits to shared branches (like main) are discouraged for team projects. Pull requests are used to propose changes from a feature branch, enabling code review and discussion before merging. They help maintain code quality and prevent unreviewed changes.

How do I fix a mistake in the last commit message?+

If the commit hasn't been pushed, use 'git commit --amend' to edit the message. If pushed, you can force-push after amending (not recommended if others have pulled). Alternatively, create a new commit with a corrected message.

What is the purpose of a .gitignore file in GitHub Foundations?+

The .gitignore file tells Git which files or patterns to ignore and not track. This prevents accidental commits of temporary files, logs, compiled binaries, or sensitive information. It's a best practice for clean repositories.

How does forking differ from branching?+

Branching creates a new line of development within the same repository, while forking creates a personal copy of the entire repository under your account. Forking is typical for contributing to projects where you don't have write access, allowing you to propose changes via pull requests.

Keep studying

Build the next review session

Browse another free bank or use the study strategy guide to turn your misses into spaced review.