All featured quizzes

Git - Basics

Git commands, staging area, commit hashes, remotes, and pull requests.

Sample Questions

A preview of what's in this quiz. Answer them interactively for instant scoring and full explanations.

What is Git?

1. What is Git?

  • A.A centralized cloud file hosting platform
  • B.A programming language compiler for C++
  • C.A database server that stores relational tables
  • D.A distributed version control system
Which Git command saves the changes currently in the staging area, creating a new snapshot in the repository history?

2. Which Git command saves the changes currently in the staging area, creating a new snapshot in the repository history?

  • A.git push
  • B.git save
  • C.git add
  • D.git commit
Which Git command is used to initialize a new, empty local Git repository in the current directory?

3. Which Git command is used to initialize a new, empty local Git repository in the current directory?

  • A.git create
  • B.git start
  • C.git clone
  • D.git init
Which Git command is used to copy an existing remote Git repository onto your local machine?

4. Which Git command is used to copy an existing remote Git repository onto your local machine?

  • A.git pull
  • B.git copy
  • C.git fetch
  • D.git clone
What is the difference between Git and GitHub?

5. What is the difference between Git and GitHub?

  • A.GitHub is the local version control tool; Git is the cloud hosting service.
  • B.Git is used for frontend code; GitHub is for backend databases only.
  • C.Git is a paid software; GitHub is entirely free and open-source.
  • D.Git is the local version control tool; GitHub is a cloud hosting service for Git repositories.
Which Git command is used to add file changes from the working directory to the Staging Area?

6. Which Git command is used to add file changes from the working directory to the Staging Area?

  • A.git stage
  • B.git commit
  • C.git save
  • D.git add
Which Git command displays the state of the working directory and the staging area, showing which files are modified, staged, or untracked?

7. Which Git command displays the state of the working directory and the staging area, showing which files are modified, staged, or untracked?

  • A.git log
  • B.git diff
  • C.git check
  • D.git status
Which flag is passed to the 'git commit' command to write the commit message directly in the terminal, without opening a text editor?

8. Which flag is passed to the 'git commit' command to write the commit message directly in the terminal, without opening a text editor?

  • A.-msg
  • B.-message
  • C.-s
  • D.-m
What are the three main local sections of a Git project?

9. What are the three main local sections of a Git project?

  • A.Local Branch, Remote Branch, and Pull Request
  • B.Source Code, Compilers, and Output Binaries
  • C.GitHub, GitLab, and Bitbucket
  • D.Working Directory, Staging Area, and Git Directory (Repository)
Which command is used to add all modified and new files in the current directory and its subdirectories to the staging area?

10. Which command is used to add all modified and new files in the current directory and its subdirectories to the staging area?

  • A.git add *
  • B.git add --all-files
  • C.git stage all
  • D.git add .
Which Git command displays the commit history of the active branch, showing commit hashes, authors, dates, and messages?

11. Which Git command displays the commit history of the active branch, showing commit hashes, authors, dates, and messages?

  • A.git status
  • B.git history
  • C.git show
  • D.git log
In Git, what is a Branch?

12. In Git, what is a Branch?

  • A.A copy of the repository stored on another remote server
  • B.A list of staging area changes awaiting commit
  • C.A database table containing commit hash index records
  • D.An independent line of development in a repository
Which Git command is used to configure your global commit author name?

13. Which Git command is used to configure your global commit author name?

  • A.git set --global author "Name"
  • B.git config user.name "Name"
  • C.git user.name = "Name"
  • D.git config --global user.name "Name"
Which Git command lists all local branches in the repository?

15. Which Git command lists all local branches in the repository?

  • A.git branch --list-all
  • B.git status
  • C.git checkout
  • D.git branch
Which Git command shows the changes between the working directory and the staging area, or between commits?

16. Which Git command shows the changes between the working directory and the staging area, or between commits?

  • A.git status
  • B.git log
  • C.git compare
  • D.git diff
What is the purpose of the '.gitignore' file in a Git project?

17. What is the purpose of the '.gitignore' file in a Git project?

  • A.To store backup copies of deleted files automatically
  • B.To encrypt files before they are pushed to remote repositories
  • C.To list all developers who have permission to commit code
  • D.To list files and folders that Git should ignore and never track in the repository
Which Git command is used to create a new branch named 'feature-abc' without switching to it?

18. Which Git command is used to create a new branch named 'feature-abc' without switching to it?

  • A.git checkout feature-abc
  • B.git switch feature-abc
  • C.git create branch feature-abc
  • D.git branch feature-abc
Which Git command is used to push your local branch commits to a remote repository?

19. Which Git command is used to push your local branch commits to a remote repository?

  • A.git pull
  • B.git upload
  • C.git commit
  • D.git push
What is a Merge Conflict in Git?

20. What is a Merge Conflict in Git?

  • A.An error thrown when a local branch has the same name as a remote branch
  • B.A network failure that occurs when pushing commits to GitHub
  • C.A compiler crash that occurs when merging Groovy build scripts
  • D.An event where changes to the same file lines on conflicting branches cannot be automatically merged by Git

Looking for a different topic? Browse all subjects