AlgoMaster Logo

Git Basics - Quiz

Last Updated: January 3, 2026

Git Basics Exercises

29 quizzes

1
Code Completion

Initialize version control in the current project directory so Git starts tracking files.

shell
1
git

Click an option to fill the blank:

2
Code Completion

Download an existing remote repository so you can work on it locally.

shell
1
git https://example.com/project.git

Click an option to fill the blank:

3
Code Completion

Stage all modified and new files in the current directory for the next commit.

shell
1
git .

Click an option to fill the blank:

4
Code Completion

Record staged changes with a descriptive message explaining the reasoning behind them.

shell
1
git commit - "Refactor payment validation"

Click an option to fill the blank:

5
Code Completion

See which files are modified, staged, or untracked before committing.

shell
1
git

Click an option to fill the blank:

6
Multiple Choice

What is the main purpose of the staging area in Git?

7
Multiple Choice

After running git init in an existing project directory, what is the most important thing you should typically do next?

8
Multiple Choice

Which statement about git clone is accurate?

9
Multiple Choice

Which commit message subject best follows recommended conventions?

10
Multiple Choice

What does a pattern like node_modules/ in .gitignore do?

11
Sequencing

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

Drag and drop to reorder, or use the arrows.

12
Sequencing

Order the steps to clone a remote repo, modify a file, and save the change.

Drag and drop to reorder, or use the arrows.

13
Sequencing

Order the steps to safely prepare a focused bugfix commit using the staging area.

Drag and drop to reorder, or use the arrows.

14
Sequencing

Order the steps to add a new ignore rule for build artifacts in an existing repository.

Drag and drop to reorder, or use the arrows.

15
Output Prediction

You are on branch feature-login. What is the output of this command?

1git branch --show-current
16
Output Prediction

You have staged changes. What will this command print?

1git status --short
17
Output Prediction

After creating a commit with message "Add API client", what does this show?

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

Find the incorrect command in this workflow to save staged changes with a message.

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

shell
1
git status
2
git add app.js
3
git commit "Implement caching layer"
4
git status
19
Bug Spotting

Identify the mistake in this attempt to create a repository and clone a remote.

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

shell
1
mkdir project-name
2
cd project-name
3
git init https://example.com/repo.git
4
git status
20
Bug Spotting

Find the incorrect command in this workflow to ignore log files before committing.

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

shell
1
echo "*.log" >> .gitignore
2
git add .
3
git commit -m "Ignore log files"
4
echo "debug.log" > debug.log
5
git add debug.log
6
git commit -m "Add debug log"
21
Matching

Match each Git concept to its description.

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

22
Matching

Match each Git command to what it mainly helps you inspect.

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

23
Matching

Match .gitignore patterns to what they ignore.

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 clone a repo into api-service and check its status.

shell
1
git https://example.com/api.git api-service
2
cd api-service
3
git

Click an option to fill blank 1:

25
Fill in the Blanks

Complete the commands to stage app.js and then commit it with a message.

shell
1
git app.js
2
git -m "Add app logic"

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the commands to create a .gitignore and verify ignored files.

shell
1
echo "node_modules/" >> .gitignore
2
git
3
mkdir node_modules
4
touch node_modules/temp.js
5
git

Click an option to fill blank 1:

27
Hotspot Selection

Click the line that shows which files are staged for commit.

Click on the line to select.

shell
1
On branch main
2
Changes to be committed:
3
  (use "git restore --staged <file>..." to unstage)
4
        modified:   src/app.js
5
Changes not staged for commit:
6
        modified:   README.md
28
Hotspot Selection

Click the line that indicates the current branch name.

Click on the line to select.

shell
1
On branch feature-api
2
Changes not staged for commit:
3
  (use "git add <file>..." to update what will be committed)
4
        modified:   api/client.js
5
Untracked files:
6
        api/new-endpoint.txt
29
Hotspot Selection

Click the line that shows an untracked file.

Click on the line to select.

shell
1
On branch main
2
Your branch is up to date with 'origin/main'.
3
 
4
Untracked files:
5
  (use "git add <file>..." to include in what will be committed)
6
        scripts/deploy.sh