AlgoMaster Logo

Introduction to Git - Quiz

Last Updated: December 2, 2025

Introduction to Git Exercises

29 quizzes

1
Code Completion

Initialize version control in an existing project directory

shell
1
git

Click an option to fill the blank:

2
Code Completion

View the full commit history of the current repository

shell
1
git

Click an option to fill the blank:

3
Code Completion

Configure your global email identity used in all repositories

shell
1
git config --global user. "you@example.com"

Click an option to fill the blank:

4
Code Completion

Create a lightweight tag to mark the current commit as v1.0.0

shell
1
git tag

Click an option to fill the blank:

5
Code Completion

Stage all modified and new files in the current repository before committing

shell
1
git .

Click an option to fill the blank:

6
Multiple Choice

What is Git primarily used for?

7
Multiple Choice

In Git’s object model, which object represents a file’s contents?

8
Multiple Choice

Which best describes a key benefit of distributed version control?

9
Multiple Choice

Why did Linus Torvalds start Git’s development in 2005?

10
Multiple Choice

Which git config scope affects all repositories for the current user by default?

11
Sequencing

Order the steps to start tracking an existing project with Git and make the first commit.

Drag and drop to reorder, or use the arrows.

12
Sequencing

Order the steps to clone a remote repository and configure your identity before committing.

Drag and drop to reorder, or use the arrows.

13
Sequencing

Order the steps to create a feature branch, work on it, and merge it back.

Drag and drop to reorder, or use the arrows.

14
Sequencing

Order the steps to configure Git to use a preferred editor globally.

Drag and drop to reorder, or use the arrows.

15
Output Prediction

You are on a branch named feature/login. What will this command print?

1git branch --show-current
16
Output Prediction

After setting your name globally, what will this command print?

1git config user.name
17
Output Prediction

You have made a commit with message "Initial commit". What will this command print?

1git log -1 --pretty=%s
18
Bug Spotting

Identify the incorrect command in this sequence for creating the first commit.

Click on the line(s) that contain the bug.

shell
1
git init
2
ls
3
git add .
4
git commit -m Initial commit
5
git status
19
Bug Spotting

Find the incorrect command while configuring your identity and making a commit.

Click on the line(s) that contain the bug.

shell
1
git config --global user.name "Alice"
2
git config --global user.mail "alice@example.com"
3
git add main.py
4
git commit -m "Add main script"
20
Bug Spotting

Spot the incorrect command in this workflow to clone a repo and create a feature branch.

Click on the line(s) that contain the bug.

shell
1
git clone https://example.com/repo.git
2
cd repo
3
git branch feature-login
4
git checkout feature-login
5
git commit -m "Start feature"
21
Matching

Match each Git object type to its role in the repository.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

22
Matching

Match each configuration-related command to what it inspects or changes.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

23
Matching

Match each concept to centralized or distributed version control.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

24
Fill in the Blanks

Complete the commands to configure your global identity and view it.

shell
1
git config --global user. "Alice"
2
git config --global user. "alice@example.com"
3
git config

Click an option to fill blank 1:

25
Fill in the Blanks

Complete the commands to initialize a repo and create the first snapshot.

shell
1
git
2
3
git .
4
git commit -m "Initial snapshot"

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the commands to configure line endings based on your workflow.

shell
1
git config --global core. true
2
git config --global core. "vim"

Click an option to fill blank 1:

27
Hotspot Selection

Click the line that shows the current branch after cloning and checking out a feature branch.

Click on the line to select.

shell
1
  main
2
* feature/signup
3
  feature/login
28
Hotspot Selection

Click the part of the status output that indicates a file is staged for commit.

Click on the line to select.

shell
1
On branch feature/api
2
Changes to be committed:
3
  (use "git restore --staged <file>..." to unstage)
4
	new file:   api/server.js
5
 
6
Changes not staged for commit:
7
  (use "git add <file>..." to update what will be committed)
8
	modified:   README.md
29
Hotspot Selection

Click the line that shows the commit message subject in this short log output.

Click on the line to select.

shell
1
commit 3f5c2e8b9a7c4e9e9c0af0a1a2b3c4d5e6f7a8b
2
Author: Alice Developer <alice@example.com>
3
Date:   Tue Nov 12 10:15:32 2024 +0000
4
 
5
    Add basic authentication feature